Subject | [spam] Re: [firebird-support] Problem with LEFT OUTER JOIN and COUNT() |
---|---|
Author | Daniel Rail |
Post date | 2006-04-10T13:57:13Z |
Hi,
At April 10, 2006, 10:25 AM, Fabio Gomes wrote:
working as expected. Also, DISTINCT applies to the result set, not
all the fields in the table(s) in the FROM clause.
--
Best regards,
Daniel Rail
Senior Software Developer
ACCRA Consultants Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)
At April 10, 2006, 10:25 AM, Fabio Gomes wrote:
> I have a pagination function in php that uses a counter to generate the pageYou might have to rethink how to get your count. Because, it is
> links and stuff, it always worked fine, but i m having a problem with this
> query:
> I m using this to count the results:
> SELECT DISTINCT COUNT(*)
> FROM SIAD_VND N
> LEFT OUTER JOIN SIAD_VED V ON (V.CODIGO = N.VEDEXT)
> WHERE TIPO='V' AND N.OBS3 LIKE '%SUS%'
> And this to show them:
> SELECT DISTINCT N.EMISSAO, N.CUPOM, N.OBS1, N.OBS3, V.DESCRICAO
> FROM SIAD_VND N
> LEFT OUTER JOIN SIAD_VED V ON (V.CODIGO = N.VEDEXT)
> WHERE TIPO='V' AND N.OBS3 LIKE '%SUS%'
> But the problem is that the COUNT() returns me 2000+ rows, and the query
> return just 1000, i tried to change the query and stuff. but it isnt
> working, i think that it have something to do with the LEFT OUTER JOIN.
> Am i doing something wrong?
working as expected. Also, DISTINCT applies to the result set, not
all the fields in the table(s) in the FROM clause.
--
Best regards,
Daniel Rail
Senior Software Developer
ACCRA Consultants Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)