0
Opa, simple thing, I have a test table, orgao and state
tables
teste = 'teste_estado_id_1'
'teste_estado_id_2'
'orgao_id'
orgao = 'orgao_id'
estado = 'estado_id'
In a query you need to relate the test table to its two state columns with the state table and the orgao_id column with the organ table.
I tried so:
select
*
from
teste, estado, orgao
where
estado.estado_id in(teste.teste_estado_id_1,teste.teste_estado_id_2) and
orgao.orgao_id = teste.teste_orgao_id and
teste.teste_ativo=1
Only I got back two records, and there should be only one.
Vlw
because the test table has 2 id table state fields?
– Brumazzi DB
Opa, are necessary in the test table to store two distinct items of the state table, are whole fields
– sNniffer
already tried to break the in in 2 instructions?
– Brumazzi DB
Could you give me an example. vlw
– sNniffer
estado.estado_id = teste.teste_estado_id_1 or estado.estado_id = teste.teste_estado_id_2
– Brumazzi DB