Count or sum query - question from a newbie

J

Ji

I have a table of 161 responses to several questions. The choices for the
answers to the questions are: excellent, good, poor, very poor or not
answered. I want to make up a query (that I can use in a report later) that
simply counts the number of the answers. So, if 155 were excellent or good,
I need to know that. Then, I'd need to know how many answered poor or very
poor etc. Can you tell me how to create a query that will do that?
 
M

Marshall Barton

Ji said:
I have a table of 161 responses to several questions. The choices for the
answers to the questions are: excellent, good, poor, very poor or not
answered. I want to make up a query (that I can use in a report later) that
simply counts the number of the answers. So, if 155 were excellent or good,
I need to know that. Then, I'd need to know how many answered poor or very
poor etc.


SELECT Sum(IIf(resp IN("Excellent","Good"), 1, 0)) As XG,
Sum(IIf(resp IN("Poor","Very Poor"), 1, 0)) As PVP,
. . .
FROM responses
 
Top