Subject | Re: [firebird-support] sum vs count |
---|---|
Author | James |
Post date | 2004-02-05T16:38:15Z |
Ann W. Harrison wrote:
Cheers
James
>At 12:31 AM 2/4/2004, James wrote:Thank Ann, David. :-)
>
>
>
>>what is the difference between
>>
>>select "counterno", sum(1)
>> from "counter"
>> group by "counterno"
>> having sum(1) > 1
>>
>>and
>>
>>select "counterno", count("counterno")
>> from "counter"
>> group by "counterno"
>> having count("counterno") > 1
>>
>>
>
>Essentially the "sum (1)" is equivalent
>to count(*). Count(<field>) is slightly
>different as it does not count rows with
>a null value of <field>. In this case,
>that matters not at all. To the best of
>my understanding these queries are equivalent.
>
>And do yourself a favor, lose the quotes.
>
>
>
Cheers
James