You are here: Re: Count() multiple columns « PHP SQL « IT news, forums, messages
Re: Count() multiple columns

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация