I have a chat database where each user belongs to a chat; this relation is represented in the table "is_member(uid, cid)". Now, when creating a new chat, I want to check if there is not already a chat with exactly these users. Here is my example table (users 1, 2, 3 and users 2, 3 have a chat together):
uid | cid ----|---- 1 | 1 2 | 1 3 | 1 2 | 2 3 | 2
Now how can I formulate my (My)SQL statement to get e.g. with the parameters uid=2 and uid=3 as output the following:
cid --- 1 2
… or with the parameters uid=1, uid=2 and uid=3:
cid --- 1
Your help is much appreciated, I'm relatively new to SQL and I found nothing similar in this regard anywhere online. Thanks in advance!