I have 3 tables:
User
------------------
ID
Name
Room
------------------
ID
Subject
Participate
-------------------
ID
room_id
user_id
and it's my sample data:
user room participate
----------------- ---------------- ---------------------
ID Name ID subject ID room_id user_id
----------------- ---------------- ---------------------
1 john 1 room1 1 1 1
2 sara 2 room2 2 1 2
3 david 3 room3 3 3 3
4 3 2
5 3 1
6 2 1
Now I access to user_id
but I want to find room_id
that have shared with user_IDs in participate
table. For example I have user_id: 1
& user_id: 2
and want to get shared room_id 1
. Already I filter participate model by user_id
but I don't know to find room_id.
Thanks