instructorgirl
Instructor
I have four ratings in a table, Excellent, Good, Fair and Poor. Sometimes for a given month, there won't be surveys for all four ratings, so I would like to display zeros in those ratings for that given month. Below is the current SQL code I am using in my query. Following the code is a sampling of the data. Instead of showing just the ratings for Excellent and Fair, I would also like to see Good and Poor showing zeros.
TRANSFORM Count(qryRateOverPlantCase.txtSessionID) AS CountOftxtSessionID
SELECT tblRatingValues.Rating, Count(qryRateOverPlantCase.txtSessionID) AS Total
FROM tblRatingValues INNER JOIN qryRateOverPlantCase ON tblRatingValues.Rating = qryRateOverPlantCase.txtOverall
GROUP BY tblRatingValues.Rating, tblRatingValues.Value
ORDER BY tblRatingValues.Value DESC
PIVOT Format([txtSubmitTime],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
CURRENT RESULT:
Rating Total Jan Feb
Excellent 2 1 1
Fair 2 1 1
WHAT I WANT TO SEE:
Rating Total Jan Feb
Excellent 2 1 1
Good 0 0 0
Fair 2 1 1
Poor 0 0 0
I would truly appreciate any help I can get. I have run out of ideas!!!!! Thanks!
TRANSFORM Count(qryRateOverPlantCase.txtSessionID) AS CountOftxtSessionID
SELECT tblRatingValues.Rating, Count(qryRateOverPlantCase.txtSessionID) AS Total
FROM tblRatingValues INNER JOIN qryRateOverPlantCase ON tblRatingValues.Rating = qryRateOverPlantCase.txtOverall
GROUP BY tblRatingValues.Rating, tblRatingValues.Value
ORDER BY tblRatingValues.Value DESC
PIVOT Format([txtSubmitTime],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
CURRENT RESULT:
Rating Total Jan Feb
Excellent 2 1 1
Fair 2 1 1
WHAT I WANT TO SEE:
Rating Total Jan Feb
Excellent 2 1 1
Good 0 0 0
Fair 2 1 1
Poor 0 0 0
I would truly appreciate any help I can get. I have run out of ideas!!!!! Thanks!