I have table user_answers :
id | quiz_id | user_id | question_id | choosen_answer_id |
1 | 1 | 2 | 1 | 5 |
2 | 1 | 2 | 2 | 6 |
3 | 1 | 2 | 3 | 7 |
4 | 1 | 3 | 1 | 5 |
5 | 1 | 3 | 2 | 8 |
6 | 1 | 3 | 3 | 9 |
I want to cont how many correct answers (same choosen_answer_id for same question_id ) has user with user_id = 3 compared with user_id = 2 on same quiz_id
In this example I should receive 1 because user with user_id = 3 answered correct only on question with question_id=1 (for user_id = 2, question_id = 1 choosen_answer_id = 5 and for user_id = 3, question_id = 1 choosen_answer_id = 5`).
Thanks
user_id = 2but it does not matter. Мaybe "correct are answers" is not in place, and my question should be: count how many answers are same for same question