Counting survey responses, 4 queries or 1 query??

T

tlyczko

I have a 'survey' database. I store the questions and responses in
separate tables.

tblResponses has the following fields:

ResponseID (PK)
Question ID (FK)
Survey ID (so I know which responses go with which survey)
txtResponse (values can be Y (Yes), N (No), or X (Not Applicable)
a few other fields

I know it's easy to make separate 'counting' queries to count all the Y
answers, all the N answers, all the X answers.

Is it possible to create ONE query that gives counts of all the
different possible answers??

That is, have a query which gives results, for example, 37 Yes, 29 No,
10 X (Not Applicable) PER Question ID????

Or do I need to use three separate queries anyway, then use a fourth
query to bring together all the results and calculate percentages and
whatnot???

I would prefer not to use crosstab queries, there are MANY questions
per survey...and crosstab queries don't scale up to SQL Server...

I hope this is enough information...

Thank you, Tom
 
T

tina

SELECT txtResponse, Count(ResponseID) AS ResponseTotal
FROM tblResponses
GROUP BY txtResponse;

hth
 

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

Top