How to do intersection on a composition table
问题 I have a simple SQL relational model with a many to many relation. Here is the composition table ___________________________ | object1_id | object2_id | |---------------------------| I would like to know all the object1 that are common to a set of object2 . My basic feeling is to do a request like this SELECT c.object1_id FROM composition c WHERE c.object2_id = <given_id_1> INTERSECT SELECT c.object1_id FROM composition c WHERE c.object2_id = <given_id_2> And if I have N object2 in the set, I