I have a table of test answers where answer_result=1 if the answer was correct. There are 50-100 different questions represented in the table with hundreds of responses each. Columns include: question_id, test_id,answer_result, answer, correct_answer.
For each question within a given test_id, I'd like to:
1. Count the number of answers
2. Count the number of correct answers
3. Provide the percentage of correct answers
4. Limit to a specific test_id (for example, where test_id = 382)
question_id test_id total correct percent
2238 382 402 326 81%
2239 382 532 235 44%
How can I do this in one query statement?