Good afternoon, guys.
I changed the diagram of a bank I had and now I need a help to select correctly.
I have four tables, where: 1 - Faculty 2 - Training 3 - Coordinator 4 - Instructor
From the faculty, any data can be instructor or coordinator. From training, any data gets n coordinators and n instructors.
I need to do a select with join to display 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