lundi 9 mars 2015

check if a column contains ALL the values of another column - Mysql


Vote count:

0




Let's suppose I have a table T1 with people IDs and other stuff IDs, as the following



Table: T1
personID | stuffID
1 | 1
1 | 2
1 | 3
1 | 4
2 | 1
2 | 4
3 | 1
3 | 2


And another table T2 with just one column of stuffIDs



Table: T2
stuffID
1
2
3


The result that I would get, by a SELECT, is a table of peopleIDs who are connected with ALL the stuffIDs of T2.


Following the example the result would be only the id 1 (the personID 3 has no to appear even if all the stuffIDs it is associated are included in T2.stuffID).



asked 49 secs ago







check if a column contains ALL the values of another column - Mysql

Aucun commentaire:

Enregistrer un commentaire