Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Statement in Range
Message
De
05/02/2001 15:44:13
 
 
À
05/02/2001 13:14:03
Coann Teng
Computer Infobase System S/B
Kuala Lumpur, Malaisie
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00472564
Message ID:
00472664
Vues:
31
You can do this with a derived table

SELECT
label,
COUNT(*)
FROM (
SELECT
CASE
WHEN Age BETWEEN 1 AND 20 THEN '1-20'
WHEN Age BETWEEN 21 AND 40 THEN '21-40'
WHEN Age BETWEEN 41 AND 60 THEN '41-60'
ELSE '>60'
END AS label
FROM thetable )
GROUP BY label

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform