0
I have the following scheme:
tblpessoa with fields: idPessoa, name.
tblcity com os campos: idCidade, codCidade, nome, idPessoa(fk da tabela tblpessoa), codigoRegiaoCidade(fk da tabela tblregiaoCidade).
tblregiaoCity with the fields: codeCity, name.
So I want to bring the name of the person, codeCity and codeCity(fk from table tblregiaoCity). And I do the following query, but returns nothing.
SELECT c.codCidade,
p.nome,
c.codigoRegiaoCidade
FROM tblcidade c,
tblpessoa p
WHERE c.ID_PESSOA = p.ID_PESSOA
AND c.codCidade = 23
AND c.codigoRegiaoCidade = 89 ;
Does anyone know where the problem is?
Thank you for the answer. So, in this case there is the correlation in the Where clause, ie: WHERE c.ID_PESSOA = p.ID_PESSOA. If I take this line "AND c.codigoRegiaoCidade = 89" the query returns some results, if I take this line: "AND c.codCidade = 23" and go back to the previous one, I also get results, but if I leave both, it returns absolutely nothing.
– Tid
And was it to return something? Oce has in the table some record with codeCity = 23 and c.codeCity = 89 ?
– David Schrammel
Hello David, yes, there is such data in the comic book.
– Tid
In the big case, these matches must be in the same record, try putting instead of
and
theor
and see if this condition of codeCity = 23 and codeCity = 89 agree to the same record– Ronaldo Filho