Count pr. dato
HejJeg har følgende view:
SELECT TOP 100 PERCENT A.RESULDAT AS Datum, B.PHRACODE
FROM dbo.OLTESTIN A INNER JOIN
dbo.OLANCOMM B ON A.TESTNO = B.TESTNO AND A.SERIALNO = B.SERIALNO AND A.ANALYS = B.ANALYS
WHERE (A.TESTTYPE LIKE 'FO-KESO-NA%' OR
A.TESTTYPE LIKE 'FO-C4-LI%' OR
A.TESTTYPE LIKE 'FO-C4-EM%' OR
A.TESTTYPE LIKE 'FO-C4-KA%' OR
A.TESTTYPE LIKE 'FO-C4-RE%' OR
A.TESTTYPE LIKE 'FO-C4-HY%') AND (A.RESULDAT > GETDATE() - 250) AND (A.ANALYS IN ('UTS-DIR', 'KONS-DIR'))
GROUP BY A.RESULDAT, B.PHRACODE
Jeg vil gerne have antal af forskellige PHRACODE pr. dato
Eksempel:
Dato | code1 | code2 | code3 | code4 | code5 | osv
12/6 | 10 | 0 | 1 | 0 | 0 |
13/6 | 2 | 3 | 0 | 0 | 1 |
14/6 | 0 | 4 | 2 | 10 | 0 |
Hvordan gør jeg det?