I have 3 tables and want to select all of the records in table 1 where ALL the records in table 2 join table 3 and are checked.
I know there is a way with a sub-query, but do not know what it is.
A simple who is taking what classes question.
I am using sqlite3 as the database.
Students
table t1 (id int, name text)
id name
------- ---------
1 Smith
2 Jones
3 Wilson
--------------------------------------------------
Classes
table t2 (class int, student int)
class student
------- ---------
1 1
1 2
1 3
2 1
2 2
3 1
3 3
4 2
4 3
Selected
table t3 (t3class int, t3checked boolean)
t3Class t3Checked
------- ---------
1 false
2 false
3 true
4 true
Who is taking the classes
Class Name
----- --------
1,2 = Smith, Jones
1,3 = Smith, Wilson
1,4 = Jones, Wilson
1,2,4 = Jones
1,2,3,4 =
Aucun commentaire:
Enregistrer un commentaire