Query MySQL Same Column Different Parameters

0

Oops, simple thing, I have a test table, organ and state

tables

teste = 'teste_estado_id_1'
        'teste_estado_id_2'
        'orgao_id'

orgao = 'orgao_id'

estado = 'estado_id' 

In an exact query, connect the test table with its two state columns with the state table and the orgao_id column with the orgao table.

I tried this way:

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 two records returned to me, and should be just one.

Vlw

    
asked by anonymous 02.04.2016 / 21:12

0 answers