You are here: Re: How to select count records that "contain" data? « MsSQL Server « IT news, forums, messages
Re: How to select count records that "contain" data?

Posted by Arto V Viitanen on 09/20/07 06:29

Ed Murphy wrote:
> Terry Olsen wrote:
>
>> Yes, that works. But it doesn't show the row with no completes. So
>> unless a person has at least one complete, they won't show.
>> This will work for me, but is there a way to get it to include the
>> people with no completes?
>
> select Name, count(case Status when 'Complete' then 1 else 0 end)
> from <<tablename>>
> group by Name
> order by Name

I guess you meant


select Name, sum(case Status when 'Complete' then 1 else 0 end)
from <<tablename>>
group by Name
order by Name

--
Arto Viitanen

 

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

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