How to query a join table so that multiple criteria are met? How to query a join table so that multiple criteria are met? sql sql

How to query a join table so that multiple criteria are met?


This should work:

SELECT member_IDFROM responsesWHERE response_ID IN (1,5)GROUP BY member_IDHAVING COUNT(DISTINCT response_id) = 2

You need to count the number of records returned which is equal to the number of values supplied in your IN clause.

SQLFiddle Demo