CrossTab Query question

C

cinnie

hello to all

I have a Report that is based on two crosstab queries, qryA and qryB (shown
below). Because these both have exactly the same Row Headings and exactly
corresponding records. They differ only in the PivotField Column Headings,
I'm wondering if they could be combined into a single query. (What I'm doing
now is combining qryA and qryB into a third qryAB, then basing my Report on
that, but I'd really like to know if this can be done in just one query).
I've tried many times but had no luck so far.

'qryA
TRANSFORM Count(A) AS CountOfA
SELECT qryEmp.ZoneID, qryEmp.Div
FROM qryEmp
GROUP BY qryEmp.ZoneID, qryEmp.Div
PIVOT qryEmp.A;

'qryB
TRANSFORM Count(B) AS CountOfB
SELECT qryEmp.ZoneID, qryEmp.Div
FROM qryEmp
GROUP BY qryEmp.ZoneID, qryEmp.Div
PIVOT qryEmp.B;

'qryAB
SELECT qryA.*, qryB.*
FROM qryA INNER JOIN qryB ON (qryA.ZoneID = qryB.ZoneID) AND (qryA.Div =
qryB.Div);

Thanks in advance!
 

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

Top