Hi all,
I have a simple table that stores survey response records. 3 questions, 1 comment field, and a record id. The answers in each question column can be from 1 to 5.
recordid | q1 | q2 | q3
1 4 2 1
2 5 4 5
3 3 2 3
I would like to write a query that counts the number of responses for each possible answer, but for each question of the survey.
For computing the totals on one column I can use this:
SELECT Q1 AS AnswerValue, Count(Q1) AS NumAnswers
FROM Results
GROUP BY Q1
HAVING Q1<>"";
I want to compute these totals for each column, but I can't think of the code required. Any suggestions?
I have a simple table that stores survey response records. 3 questions, 1 comment field, and a record id. The answers in each question column can be from 1 to 5.
recordid | q1 | q2 | q3
1 4 2 1
2 5 4 5
3 3 2 3
I would like to write a query that counts the number of responses for each possible answer, but for each question of the survey.
For computing the totals on one column I can use this:
SELECT Q1 AS AnswerValue, Count(Q1) AS NumAnswers
FROM Results
GROUP BY Q1
HAVING Q1<>"";
I want to compute these totals for each column, but I can't think of the code required. Any suggestions?