Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Update question
You can only do this if the select part of the SQl will only return one record for each record being updated.
I suspect what you are missing is the correlation between your select tables and your update tables. Try something like
update table1
set column1=(select feature from table2, table3
where table2.column2=table3.column2 and table2.column3 = table1.column3)
so that what is being selected is correlated with the current record being updated. Of course you will need to correlate the selct so only one record is retrieved...
-- Alan D. Mills To email remove NOSPAM from address. Linda K. Johnson wrote in message <3576ABF3.CA67D2B_at_lctx.com>...Received on Fri Jun 05 1998 - 00:00:00 CDT
>Is there a way to update one table with selected fields from another
>table? The only way we see (and it doesn't work) requires trying to
>return more than one row to the set statement.
>
>i.e.
> update table1
> set column1=(select feature from table2, table3
> where table2.column2=table3.column2)
>
>It returns too many rows to the update. Thanks for any help.
>
>Please send any responses to pacosta_at_lctx.com or the newsgroup.
>
>
>Thanks again,
>
>Paul Acosta
>
>