I have the following table
id group_id user_id
1 2 11
2 2 12
3 2 13
4 3 11
5 3 12
6 4 11
Now I want the common group IDs Means if
I pass user_id (11,12) then result will be group_id (2 and 3)
I pass user_id (11) then result will be group_id (2,3 and 4)
I pass user_id (11,12,13) then result will be group_id (2)
I pass user_id (13,15) then result will be zero group_id (NULL)
I am working with CodeIgniter but you can suggestion me in core SQL. It would be good if your answer is in CI model(query) standard.