I have the sql schema like this:
ID | Like
______|_______
p1 | 2
p1 | 3
p1 | 4
p2 | 3
p2 | 2
p3 | 2
p3 | 3
p3 | 4
p4 | 3
p4 | 2
So I have to Select pairs of people, who like same things. (In this example: [p1,p3] and [p2,p4]). All ‘like’ should be same, so [p1,p2] is wrong!
How can I do that?
Ahead thank you for the answers!
This is a relational division operation. You can do this with a combination of NOT EXISTS clauses, e.g.: