I need to produce a report listing how much users created a case note per month per ethincity and sex. So something like this
So far I have the sql
I just have no idea how to convert to the desired result. Can anyone help??
thanks in advance
Tanya
Year Month User Ethnicity1 Ethinicity2
2010 Jan Tanya 2 3 1 6Male Female Male Female
2010 Jan Therese 1 4 4 4
2010 Feb Tanya 6 7 3 2
2010 Feb Therese 9 2 7 4
So far I have the sql
SELECT [Year], [Month], User , Count(Description) AS Total
FROM (
SELECT year(DateTime) AS [Year], month(DateTime) AS [Month], User, Description, Patient.PracSoftId, Patient.Sex AS Sex, Patient.Ethnicity AS Ethnicity
FROM CaseNote
INNER JOIN Patient
ON CaseNote.PatientId = Patient.PracSoftId) AS [%$##@_Alias]
GROUP BY [year], [month], [user];
Year Month User Total
2010 1 Tanya 12
2010 1 Therese 13
2010 2 Tanya 18
2010 2 Therese 22
I just have no idea how to convert to the desired result. Can anyone help??
thanks in advance
Tanya