Combining Queries (2)

  • Thread starter Thread starter AGOKP4
  • Start date Start date
A

AGOKP4

Hi,

Is it possible to combine these queries below to get a single one?

Thanks!!!

TRANSFORM Count([Screened Qry Mt Sinai].[Study ID]) AS [CountOfStudy ID]
SELECT [Screened Qry Mt Sinai].[Creatinine Group], Count([Screened Qry Mt
Sinai].[Creatinine Group]) AS [CountOfCreatinine Group], [Sex]
FROM [Screened Qry Mt Sinai]
GROUP BY [Screened Qry Mt Sinai].[Creatinine Group], [Sex]
PIVOT [Screened Qry Mt Sinai].Tenofovir;

TRANSFORM Count([Screened Qry Tufts].[Study ID]) AS [CountOfStudy ID]
SELECT [Screened Qry Tufts].[Creatinine Group], [Screened Qry Tufts].Sex,
Count([Screened Qry Tufts].[Creatinine Group]) AS [CountOfCreatinine Group]
FROM [Screened Qry Tufts]
GROUP BY [Screened Qry Tufts].[Creatinine Group], [Screened Qry Tufts].Sex
PIVOT [Screened Qry Tufts].Tenofovir;

TRANSFORM Count([Screened Qry UAB].[Study ID]) AS [CountOfStudy ID]
SELECT [Screened Qry UAB].[Creatinine Group], Count([Screened Qry
UAB].[Creatinine Group]) AS [CountOfCreatinine Group], [Sex]
FROM [Screened Qry UAB]
GROUP BY [Screened Qry UAB].[Creatinine Group], [Sex]
PIVOT [Screened Qry UAB].Tenofovir;
 
I see you posted the same question in the report's news group. It is much
better to post to only one group.

This was my suggestion there:
Create a union query of your individual select queries first:

SELECT [Study ID], [Creatinine Group], [Sex], Tenofovir
FROM [Screened Qry Mt Sinai]
UNION ALL
SELECT [Study ID], [Creatinine Group], [Sex], Tenofovir
FROM [Screened Qry Tufts]
UNION ALL
SELECT [Study ID], [Creatinine Group], [Sex], Tenofovir
FROM [Screened Qry UAB];

Then create a crosstab from the result.
 
Back
Top