Select inside where in () does not work.

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Thu, 05 Apr 2007 9:16 am

Guys IM trying to do the following: Have the select1 it's working when I do this:
Code: Select all
select * from tabela where campo in (valor1, valor2)
Works fine, however the values I need to get through another select, so I tried to assemble as follows:
Code: Select all
select * from tabela where campo in (select * from tabela2 where campo_2 = 132453)
I'vê tested this second select and the same only returns valid values for the first select, however when I try to use this select (to test in SQLDeveloper) accuses the error: ORA-00913: too many values.
For sure I'm erring on the select, can anyone give a hand?
pyro
Location: Barala - TT

Poston Thu, 05 Apr 2007 5:25 pm

Brother, so it won't work right, remove the asterisk and insert a corresponding field ... try doing so: select * from table where field in (select field from table2 where field_2 = 132453)
cleberzumba
Location: Brasília-DF

Cleber Zumba de Souza

Poston Mon, 09 Apr 2007 8:06 am

Thanks man, I should have drank too much when I did it.
hehe.
pyro
Location: Barala - TT


  • See also
    Replies
    Views
    Last Post


      Return to SQL

      Who is online

      Users browsing this forum: No registered users and 3 guests