|
Posted by Boris Stumm on 05/15/07 13:00
Captain Paralytic wrote:
> On 15 May, 10:31, Boris Stumm <s...@informatik.uni-kl.de> wrote:
>> sum(case when col is null then 0 else 1 end)
>>
>> I am not sure if that is the most clever solution, and if it works with
>> MySQL, but for me it worked when I wanted two counts in one select.
>
> Wouldn't that be slightly neater as
> SUM(IF(`col`,1,0))
Yes, if the DBMS supports that :-)
(I usually dont use MySQL)
Navigation:
[Reply to this message]
|