I have a table called participants with the following fields:
The background is that there ar
Using your query will not work since the where
clause filters out the user_ids. Use
SELECT * FROM participants
GROUP BY conversation_id
HAVING sum(user_id not in (1,2)) = 0
user_id not in (1,2)
returns 1
if a user_id
other than 1,2
are in a conversation and 0
otherwise. So using SUM
you can add up all that cases. If none are found then the sum is 0
.