Listo ya salio la consulta
------ SELECT * FROM tabla_valores, tabla_ datos where camp1 = ANY (ARRAY[val1, val2, val3, val4]); ------ select * from tabla_valores where camp1 in( select val1 from tabla_ datos union select val2 from tabla_ datos union select val3 from tabla_ datos union select val4 from tabla_ datos ) Muchas gracias!! El 15 de agosto de 2013 10:21, Miguel Angel Hernandez Moreno < [email protected]> escribió: > Ok > > eh intentado con el array pero me marca un pequeño error > > > SELECT * from tabla_valores > where camp1 = ANY ( > select ARRAY[val1, val2, val3, val4] FROM tabla_ datos ) > > > > ----------------------------------------------------------------------------------------------------------------- > ERROR: operator does not exist: numeric = numeric[] > LINE 4: camp1 = ANY (select ARRAY[val1, val2, val3... > ^ > HINT: No operator matches the given name and argument type(s). You might > need to add explicit type casts. > > ********** Error ********** > > ERROR: operator does not exist: numeric = numeric[ > > ----------------------------------------------------------------------------------------------------------------- > > > ya trate de verlo haciendo un cast a numeric[] > pero marca error tambien, si alguien le a pasado algo asi les agradeceria > mucho > > Muchas gracias por su ayuda!! :D > > > > > El 14 de agosto de 2013 15:55, Alvaro Herrera > <[email protected]>escribió: > > > Y se hace una consulta similar de la siguiente manera >> > >> > select * from tabla_valores >> > where camp1 in( >> > select val1 from tabla_ datos union >> > select val2 from tabla_ datos union >> > select val3 from tabla_ datos union >> > select val4 from tabla_ datos >> > ) >> >> Uh. Yo intentaría hacer algo con >> WHERE camp1 = ANY (ARRAY[val1,val2...]) >> donde la obvia dificultad es asegurarse que se usen los índices >> pertinentes. >> >> -- >> Álvaro Herrera http://www.2ndQuadrant.com/ >> PostgreSQL Development, 24x7 Support, Training & Services >> > > > > -- > ISC Miguel Angel Hernandez Moreno > -- ISC Miguel Angel Hernandez Moreno
