Count or sum query - question from a newbie

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top