I have a table with two columns of ids.
TABLE
id1 id2
1 1
1 2
1 3
2 1
2 6
2 2
3 1
3 10
3 3
I would like to SELECT every id1 that is matched to a certain combination of id2s.
For example, if I have id2 = [1, 2, 3] I would like to return id1 = [1];
If I have id2 = [1, 6] I would like to return id1 = [2];
If I have id2 = [1] I would like to return id1 = [1, 2, 3].
Any suggestions on how to best accomplish this would be appreciated.
Thanks,