0
I would like to elaborate an SQL using LEFT JOIN. I wrote this SQL, but it didn’t work:
SELECT
*,
p.parametro AS cidade,
cpr.codTipo AS tipoAcompanhante
FROM
cadastroperfil AS cp,
cadastroprofissional AS cpr,
parametro AS p
WHERE
cp.verificado = '1'
AND
cp.codCadastroPerfil = '11'
AND
cpr.codCadastroPerfil = '11'
AND
cp.codCidade = p.idParametro
The return is zero, but there are records in the database. Can anyone suggest anything to me? Thank you
All these tables have relationship with each other, through the codCadastroPerfil
are not which database engine you are using, but you wouldn’t have to specify that you want a LEFT JOIN? Example: FROM cadastre profile as cp LEFT JOIN cadastroprofissional as cpr on (cp.codCadastroPerfil = cpr.codCadastroPerfil)?
– cantoni
Maybe yes but since there are several tables I think it could be in an SQL so
– Sr. André Baill
the first sentence of my comment became meaningless. I asked which database engine you are using. Anyway, I posted an answer. I hope it helps you.
– cantoni
Hello, André. Could you be more specific about what results you would like to return? Your SELECT did not make it very clear what the intent of the query is.
– Dherik