A
AGOKP4
Hi,
I managed to create a query of the same kind of data for 2 groups (see SQL
query below) with your help and would now like to make a report with the
groups in columns and the results in rows eg
A B
age xx xx
sex xx xx
ethnicity... xx xx
SELECT "Age" as Source,
[ALL BY CENTER QRY].[Age Group],
Count([ALL BY CENTER QRY].[Age Group]) AS [CountOfAge Group],
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].[Age Group],
Center
UNION ALL
SELECT "Sex" as Source,
[ALL BY CENTER QRY].Sex,
Count([ALL BY CENTER QRY].Sex) AS CountOfSex,
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].Sex,
Center
UNION ALL
SELECT "Race" as Source,
[ALL BY CENTER QRY].Race,
Count([ALL BY CENTER QRY].Race) AS CountOfRace,
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].Race,
Center
UNION ALL
SELECT "Ethnicity" as Source,
[ALL BY CENTER QRY].Ethnicity,
Count([ALL BY CENTER QRY].Ethnicity) AS CountOfEthnicity,
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].Ethnicity,
Center
UNION ALL
SELECT "Tenofovir" as Source,
[ALL BY CENTER QRY].Tenofovir,
Count([ALL BY CENTER QRY].Tenofovir) AS CountOfTenofovir,
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].Tenofovir,
Center
UNION ALL SELECT "Creatinine Group" as Source,
[ALL BY CENTER QRY].[Creatinine Group],
Count([ALL BY CENTER QRY].[Creatinine Group]) AS [CountOfCreatinine Group],
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].[Creatinine Group],
Center
ORDER BY Center, source;
I managed to create a query of the same kind of data for 2 groups (see SQL
query below) with your help and would now like to make a report with the
groups in columns and the results in rows eg
A B
age xx xx
sex xx xx
ethnicity... xx xx
SELECT "Age" as Source,
[ALL BY CENTER QRY].[Age Group],
Count([ALL BY CENTER QRY].[Age Group]) AS [CountOfAge Group],
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].[Age Group],
Center
UNION ALL
SELECT "Sex" as Source,
[ALL BY CENTER QRY].Sex,
Count([ALL BY CENTER QRY].Sex) AS CountOfSex,
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].Sex,
Center
UNION ALL
SELECT "Race" as Source,
[ALL BY CENTER QRY].Race,
Count([ALL BY CENTER QRY].Race) AS CountOfRace,
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].Race,
Center
UNION ALL
SELECT "Ethnicity" as Source,
[ALL BY CENTER QRY].Ethnicity,
Count([ALL BY CENTER QRY].Ethnicity) AS CountOfEthnicity,
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].Ethnicity,
Center
UNION ALL
SELECT "Tenofovir" as Source,
[ALL BY CENTER QRY].Tenofovir,
Count([ALL BY CENTER QRY].Tenofovir) AS CountOfTenofovir,
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].Tenofovir,
Center
UNION ALL SELECT "Creatinine Group" as Source,
[ALL BY CENTER QRY].[Creatinine Group],
Count([ALL BY CENTER QRY].[Creatinine Group]) AS [CountOfCreatinine Group],
Center
FROM [ALL BY CENTER QRY]
GROUP BY [ALL BY CENTER QRY].[Creatinine Group],
Center
ORDER BY Center, source;