Cross Tab Query condition on Pivot

Jim Dudley

Registered User.
Local time
Today, 00:49
Joined
Feb 16, 2012
Messages
81
In a cross tab query is it possible to put a qualifier in the Pivot statement to group all values over a certain amount?

SQL:

TRANSFORM Count(tbl_Attendance.Type) AS CountOfType
SELECT tbl_Attendance.WCode, tbl_Attendance.SNUM, Count(tbl_Attendance.Type) AS [Total Of Type]
FROM tbl_Attendance
WHERE (((tbl_Attendance.Credits)<=4))
GROUP BY tbl_Attendance.WCode, tbl_Attendance.SNUM
PIVOT tbl_Attendance.Credits;

e.g. The Pivot is on [Credits].
What I want is a count of students with 1 credit, 2 credits, 3 credits and 4 or more( >=4). in the 4th column. How would you write this instruction, if it is possible.

Thank you.

Jim
 
Pivot on this expression:
Code:
Switch([Credits] = 1, "1 Credit", [Credits] = 2, "2 Credits", [Credits] = 3, "3 Credits", [Credits] >= 4, "4 or more Credits")
 
Thank you worked like a charm after I removed the 'Where' statement.

Jim
 

Users who are viewing this thread

Back
Top Bottom