0
In the table turma_materia has the following information.
CODIGO | MATERIA | TURMA
---------------------------------
1 | 1 | 2
In the table Materia has the following information
CODIGO | NOME DA MATERIA
1 | PORTUGUES
2 | MATEMATICA
3 | INGLES
I want to take the name of the materials (2-MATEMATICA, 3-INGLES) that is not related in the code class 2 So far you can only get the code below.
SELECT MA.mat_nome, TM.turma_tuma, TM.materia_tuma FROM materia MA
LEFT JOIN turma_materia TM ON MA.mat_id=TM.materia_tuma
WHERE TM.turma_tuma<>1
Additional information: https://answall.com/questions/6441/70
– Bacco
SELECT * FROM materia WHERE NOT IN code ( SELECT materia FROM turma_materia WHERE class = 2 )
– Diego Schmidt
Thank you so much for the help, I get in the following script SELECT * FROM materia WHERE materia.mat_id NOT IN (SELECT turma_materia.materia_tuma FROM turma_materia WHERE turma_materia.turma_tuma=1);
– Daniel Alencar Souza