0
I have the following query
SELECT p.nome_completo, p.id_pessoa, curr.link_video, prof.nome as nome_profissao, fav.id_favorito as fav_id
FROM candidato as cand
INNER JOIN pessoa as p on (p.id_pessoa = cand.fk_pessoa)
INNER JOIN curriculo as curr on (cand.id_candidato = curr.fk_candidato)
INNER JOIN curriculo_has_profissao as chp on (curr.id_curriculo = chp.fk_id_curriculo)
INNER JOIN profissao as prof on (chp.fk_id_profissao = prof.id_profissao)
LEFT JOIN empregador_has_favorito_curriculo as efc on (efc.fk_id_curriculo = curr.id_curriculo)
LEFT JOIN favorito as fav on (fav.id_favorito = efc.fk_id_favorito)
WHERE prof.nome LIKE '%Abastecedor de Linha de Produção%' OR prof.nome LIKE '%Abastecedor de Máquinas%'
AND curr.fk_status_curriculo = 2
The idea is to bring all candidates when searching for a profession by name. I am using LIKE in case looking for Professor
Return all types of registered teachers..
the strange thing about this query is that when I perform it, returns a result, with the profession Abastecedor de Linha de Produção
, but if I remove the OR
, leaving only the first clause of WHERE
, should return the same result, since the profession is the same. But no, does not return any resutlado. I also tested exchange for '%Abastecedor%'
to see if it would return any results, but also returned nothing.
Any idea ?
Could be something related to the origin of the logical operators, I tried to put the clauses of
or
in brackets.– Miyukii
That’s not the point, the problem is with the
OR
he finds results with the professionAbastecedor de Linha de Produção
, as in the query. The problem is when I leave only theprof.nome LIKE '%Abastecedor de Linha de Produção%'
should return a result, but does not return– Matheus Barbosa