Afficher un message
Vieux 20/09/2007, 07h29   #5
Arto V Viitanen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to select count records that "contain" data?

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
  Réponse avec citation
 
Page generated in 0,05266 seconds with 9 queries