select cod_act1, cod_act2, nivell_relacio from tabla a, tabla b where a.cod_act1=b.cod_act2 and a.cod_act2=b.cod_act1