Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Update a Table from a Second Table
This is an easy way to update a table from a second table in Sql
Server.
update table1
set table1.col2 = table2.col2
from table1, table2
where table1.keycol = table2.keycol
I know you can do something like this in Oracle:
update table1 a
set table1.col2 = (select col2 from table2 where table2.keycol =
a.keycol)
but that example will update every row in table1, not just the ones that match the rows in table2.
The sql server version not only gets the values it needs from the second table, it also limits the rows updated to those the matching rows in table2.
Is there an easy way to do this in Oracle?
thanks much Received on Fri Jun 27 2003 - 15:53:06 CDT
![]() |
![]() |