If I had these tables
+--------+-----+
| ID | oid |
+--------+-----+
| 0 | 1 |
| 2 | 1 |
| 0 | 2 |
+--------+-----+
+--------+
| num |
+--------+
| 1 |
| 2 |
+--------+
I would get ID 0 back because it has both num 1 and 2.
How would I go about getting that?