Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
2 column counts
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00597595
Message ID:
00597847
Vues:
14
I think this gets you everything, except it's all on one row.
SELECT
 SUM(CASE WHEN r.roomtype = 1 AND r.sex = 'M' THEN 2 ELSE 0 END) AS dblM,
 SUM(CASE WHEN r.roomtype = 1 AND r.sex = 'F' THEN 2 ELSE 0 END) AS dblF,
 SUM(CASE WHEN r.roomtype IN (2,3) AND r.sex = 'M' THEN 1 ELSE 0 END) AS sinM,
 SUM(CASE WHEN r.roomtype IN (2,3) AND r.sex = 'F' THEN 1 ELSE 0 END) AS sinF,
FROM
 rooms r
WHERE
 r.hall = @building 
 and cast(r.roomNum/100 as int)=@floor -- can this be a BETWEEN?
 and r.onLine=1 
 AND r.staff=0 
 and r.periodID=4
-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform