Union Queries

A

AGOKP4

Hi,

I sit possible to make union queries from crosstab queries? I have tried a
couple of times without luck. The queries I hope to combine are listed below.

Thanks

TRANSFORM Count([Enrolled F Qry].Tenofovir) AS CountOfTenofovir
SELECT [Enrolled F Qry].[Creatinine Group], Count([Enrolled F
Qry].[Creatinine Group]) AS [CountOfCreatinine Group]
FROM [Enrolled F Qry]
GROUP BY [Enrolled F Qry].[Creatinine Group]
PIVOT [Enrolled F Qry].Tenofovir;

TRANSFORM Count([Enrolled M Qry].[Study ID]) AS [CountOfStudy ID]
SELECT [Enrolled M Qry].[Creatinine Group], Count([Enrolled M Qry].[Study
ID]) AS [Total Of Study ID]
FROM [Enrolled M Qry]
GROUP BY [Enrolled M Qry].[Creatinine Group]
PIVOT [Enrolled M Qry].Tenofovir;

TRANSFORM Count([Enrolled Qry].Race) AS CountOfRace
SELECT [Enrolled Qry].Ethnicity, Count([Enrolled Qry].Ethnicity) AS
CountOfEthnicity
FROM [Enrolled Qry]
GROUP BY [Enrolled Qry].Ethnicity
PIVOT [Enrolled Qry].Race;
 
D

Duane Hookom

You can't use "UNION" in a crosstab query. You should be able to UNION the
results of the crosstabs if the number of columns is always the same.

SELECT *
FROM crosstab1
UNION
SELECT *
FROM crosstab2
UNION
SELECT *
FROM crosstab3;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Combine Crosstab Queries? 2
Combining Queries 4
Combining Queries (2) 1
Joining Crosstab queries 3
Combine Queries (2) 6
Report by group in columns 8
Sorting data from different centers 10
query too slow 1

Top