combine cross-tab union query with simple query

luzz

Registered User.
Local time
Today, 13:56
Joined
Aug 23, 2017
Messages
346
Hi all, I would like to combine my crosstab union query with a simple query as one query.

Below is my union crosstab query
Code:
SELECT [Size breakdown], XS, S, M, L, XL
FROM [CollarLengthAndWidthQuery];
UNION SELECT [Size breakdown], XS, S, M, L, XL
FROM [CuffLengthAndWidthQuery];

Below is my simple query:
Code:
SELECT CollarCuffQuery.PO, CollarCuffQuery.[Style NO], CollarCuffQuery.[GL Lot], CollarCuffQuery.ShipName, CollarCuffQuery.Date
FROM CollarCuffQuery;
 
I can't see any common column between the two queries, so you I would say you can't. If you have a sizebreakdown field in collarcuffquery, then you can join on that
 
Unless of course you do a cartesian join and get all the results from the union query combined with all the results from the simple query

BUT ...if the UNION query has 20 records and the simple query has 1000, the end result would have 20000 records....

Alternatively scrap the crosstab query and
1. Get the data you want for collars & cuffs in a select or union select query (but not crosstab)
2. Join that to your simple query
3. If required do a crosstab on the results of that

QED
 

Users who are viewing this thread

Back
Top Bottom