Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grouping help
Message
 
 
À
15/11/2007 09:42:16
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
01269131
Message ID:
01269155
Vues:
10
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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform