Hello,
I have three tables:
profissional (id, nome, idtratamento)
usuários (id, nome idtratamento)
formulario (id, data, idprofissional,idusuario)
and another:
tratamento (id, descricao)
I need to return the following information queried from the form table:
IdFormulario | Data | NomeProfissional | NomeUsuario
... ... Msc. João Sr. José
Doing the relationship between professional tables and treatment, user and treatment, how to proceed for treatment (Msc, Sr, Miss, etc.) to return in the query? I can return only 1 treatment for either professional or user. How do I return the treatments in the same sql query
SQL:
SELECT p.nome, u.nome, f.id, f.data, t.nome as tratamentouser
FROM formulario as f inner join tratamento as t on t.id = f.idusuario inner
join profissional as p on p.id = f.idprofissional