1
Good afternoon, you guys.
I changed the diagram of a bank I had and now I need a help to make a select correctly.
I have four tables, where: 1 - Faculty 2 - Training courses 3 - Coordinator 4 - Instructor
Of the teaching staff, any data can be instructor or coordinator. From the training, any data receives n coordinators and n instructors.
I need to select with Join so that it displays the training coordinator(s) and instructor(s).
SELECT * FROM treinamentos t
LEFT JOIN treinamentos_has_coordenador tc ON t.idtreinamentos = tc.treinamentos_idtreinamentos
RIGHT JOIN treinamentos_has_instrutor ti ON t.idtreinamentos = ti.treinamentos_idtreinamentos
JOIN corpo_docente ON (idcorpo_docente = tc.coordenador_idcorpo_docente
OR idcorpo_docente = ti.instrutor_idcorpo_docente)
Thank you