Predmet:Re:Više counta u jednom upitu
Evo upita,i u ovom slučaju,imam 5,6 upita u jednom sql upiti...
SELECT q1.rm, q1.Ukupno AS Cod1, q2.Ukupno1 AS Cod2, q3.Ukupno2 AS cod3, q4.Ukupno3 AS cod4, q5.Ukupno4 AS cod5, q6.Ukupno5 AS cod6, q7.Ukupno6 AS cod7
FROM ((((([SELECT DISTINCT posta.rm, Count(posta.rm) AS Ukupno
FROM posta
WHERE (((posta.[9])="6,4" Or (posta.[9])="6.4" Or (posta.[9])="6,40" Or (posta.[9])=" 8" Or (posta.[9])="8,0" Or (posta.[9])="8.0" Or (posta.[9])="7" Or (posta.[9])="7,0" Or (posta.[9])="7.0"))
GROUP BY posta.rm
]. AS q1 LEFT JOIN [SELECT DISTINCT posta.rm, Count(posta.rm) AS Ukupno1
FROM posta
WHERE [9]="Go"
GROUP BY posta.rm
]. AS q2 ON q1.rm = q2.rm) LEFT JOIN [SELECT DISTINCT posta.rm, Count(posta.rm) AS Ukupno2
FROM posta
WHERE [9]="Bo"
GROUP BY posta.rm
]. AS q3 ON q2.rm = q3.rm) LEFT JOIN [SELECT DISTINCT posta.rm, Count(posta.rm) AS Ukupno3
FROM posta
WHERE [9]="I"
GROUP BY posta.rm]. AS q4 ON q3.rm = q4.rm) LEFT JOIN [SELECT DISTINCT posta.rm, Count(posta.rm) AS Ukupno4
FROM posta
WHERE [9]="Vp"
GROUP BY posta.rm]. AS q5 ON q4.rm = q5.rm) LEFT JOIN [SELECT DISTINCT posta.rm, Count(posta.rm) AS Ukupno5
FROM posta
WHERE [9]="A"
GROUP BY posta.rm]. AS q6 ON q5.rm = q6.rm) LEFT JOIN [SELECT DISTINCT posta.rm, Count(posta.rm) AS Ukupno6
FROM posta
WHERE [9]="Pl"
GROUP BY posta.rm]. AS q7 ON q6.rm = q7.rm;