I have a profile that looks like this:
profile_id | answer_id
----------------------
1 1
1 4
1 10
I have a table which contains a list of responses by poll respondents with structure like this:
user_id | answer_id
-------------------
1 1
1 9
2 1
2 4
2 10
3 14
3 29
How do I select a list of users that gave all of the answers in the profile? In this case only user 2.
You can use the following:
See SQL Fiddle with Demo
Or another way to write this is:
See SQL Fiddle with Demo