Say Table 1: tID, tName Table 3: t2ID, tID, tSubjects

One tID can be have multiple t2ID.

What I want is list of tIDs who's t2IDs should not just have a list of t2IDs (1,5,6).

i.e They can 1,2,5,6 but not just 1 or 5 or 6 or 1,5 or 1,6 or 1,5,6 in short they tIDs should be included if they have any other t2IDs along with the ones in the list.


  • Can you elaborate a bit more plz. – Nelz Feb 20 '15 at 19:37
  • Say a student name Alex has choosed maths, science and phyics as subject, Brian has choosed science, phyics and arts, Krina has arts and science, kat has science. I want list of students who has not just choosen science, phyics or maths. In that case Krina and brian will be the output. – Vivek Sancheti Feb 20 '15 at 19:42
  • SHOW CREATE TABLE -- I can't tell whether you are coming from rows, SETs, strings, or something else. SETs would work nicely because Boolean arithmetic makes the processing easy. – Rick James Feb 20 '15 at 19:58
  • I'll say it depends a lot on the table structure and the data type... I got an scenario in mind but that will only suite my need to solve the problem since I'm probably using different table scruture and data. – Nelz Feb 20 '15 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.