Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grouping help
Message
 
 
To
15/11/2007 09:42:16
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
01269131
Message ID:
01269155
Views:
9
Sorry I should read posts more carefuly. You'll still use SUM()
  ...
  SUM( CASE WHEN status = 1 THEN 1 ELSE 0 END ) AS Status1Count,
  SUM( CASE WHEN status = 2 THEN 1 ELSE 0 END ) AS Status2Count,
  ...
>Thanks for the sample. I needed to count the number of customer instead of summing the sales, so I tried to modify your snipped like below:
>
>...
>COUNT( CASE WHEN status = 1 THEN status END ) AS Status1Count,
>COUNT( CASE WHEN status = 2 THEN status END ) AS Status2Count,
>...
>
>
>... and it seemed to work properly. Thanks for the help. Have you ever thought about going into teaching?
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform