Given table below
id | groupid | memberid
1 | g1 | m1
2 | g1 | m2
3 | g2 | m1
4 | g2 | m2
5 | g2 | m3
I'm trying to build a query where I want to get the groupid
containing exact list of memberids
.
For example :
Given input as m1, m2
-> return g1
Given input as m1
-> return nothing
Given input as m1, m2, m3
-> return g3
Assuming it to be a simple social network group table, I'm looking to find a group id containing exact list of member ids.
What I did :
I tried building the query using group by, having, count operators but wasn't able to.