Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I need help...
Message
De
23/01/2001 21:01:43
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00466473
Message ID:
00467708
Vues:
9
Oops!

It returned the same results under all the fields. Looks like this:

Sys Successful Failed Invalid Pending
1 2 2 2 2
2 5 5 5 5
3 2 2 2 2

where did it go wrong?

>Hi!
>
>Try following:
>
>Select Sys, COUNT(CASE WHEN Status=1 THEN 1 ELSE 0 END) as successful,
>COUNT(CASE WHEN Status=2 THEN 1 ELSE 0 END) as failed,
>COUNT(CASE WHEN Status=3 THEN 1 ELSE 0 END) as invalid,
>COUNT(CASE WHEN Status=0 THEN 1 ELSE 0 END) as pending
>FROM MyTable GROUP BY Sys
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform