A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

CrossTab Query question



 
 
Thread Tools Display Modes
  #1  
Old April 11th, 2010, 03:08 AM posted to microsoft.public.access.queries
cinnie
external usenet poster
 
Posts: 67
Default CrossTab Query question

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!
--
cinnie
  #2  
Old April 11th, 2010, 05:56 AM posted to microsoft.public.access.queries
Duane Hookom[_4_]
external usenet poster
 
Posts: 316
Default CrossTab Query question

There is a solution for multiple value crosstabs at
http://www.tek-tips.com/faqs.cfm?fid=4524.

--
Duane Hookom
MS Access MVP


"cinnie" wrote in message
...
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!
--
cinnie


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.