Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab quesry

Status
Not open for further replies.

99Chuck99

Programmer
Dec 11, 2003
67
US
Is it possible to create a crosstab/pivot query to change output from this table.

SORT MONTH YEAR ENG FSEU LOG
0 Oct 2009 2 8 0
1 Nov 2009 9 13 6
2 Dec 2009 9 17 6

to this

DEPT MONTH COUNT
ENG OCT 2
FSEU OCT 8
LOG OCT 0
ENG NOV 9
FSEU NOV 13
ECT....

Thanks in advance
 
I believe you could use a normalizing union query like:

Code:
SELECT [Sort], [Month], [Year], "ENG" as Dept, [Eng] as Cnt
FROM tblUnnormalized
UNION ALL
SELECT [Sort], [Month], [Year], "FSEU", [FSEU]
FROM tblUnnormalized
UNION ALL
SELECT [Sort], [Month], [Year], "LOG", [LOG]
FROM tblUnnormalized
ORDER BY 1,4;


Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top