Suppose I have a table like this:
| uid | group_id |
-----------------
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 1 | 4 |
| 2 | 1 |
| 2 | 2 |
| 2 | 3 |
| 3 | 1 |
| 3 | 2 |
| 3 | 4 |
...
How can I get the common set of group_ids for some set of uids.
For e.g.
for uid 1,2 : The common group_ids are 1,2,3
for uid 1,2,3 : The common group_ids are 1 and 2
Assuming each
group_IDis unique for everyuid, (otherwise you need to usedistinct)