Here is my dilemma... I have two tables, the structures are as follows:
student_answers
student_id
question_id
answer_id
This table contains a student's answer for each question on a test.
A question may have one or multiple answers.
test_answers
test_id
question_id
answer_id
This table contains the possible correct answers for a test question.
*Note not all test questions are represented in this table as
some questions not count towards a grade.
I need to come up with a query that does the following:
1. Finds all possible answers for each question in test_answers.
2. For each question in test answers, finds the corresponding question
in student_answers and checks that at least one answer_id in students_answers
matches at least one answer_id in test answers for each question.
3. The query should then return the student_id that has at least one correct
answer for every question in test answers.
I am using MySQL and it does not support Subqueries.
Any ideas?