0
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 consulted the form table:
IdFormulario | Data | NomeProfissional | NomeUsuario
... ... Msc. João Sr. José
making the relationship between the professional tables and treatment, user and treatment, how to proceed to the treatment (Msc, Mr, Ms, etc.) return in the consultation? I can return only 1 treatment to 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
What is the relationship between professional and user?
– Jeferson Almeida
@Jefersonalmeida updated the question
– lelopes