Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Update a table with another
Mark C. Stock schrieb am 08.10.2005 in
<AJqdnX4Hidx_E9renZ2dnUVZ_tKdnZ2d_at_comcast.com>:
> you need a correlated subquery.
> update x
> set y = (select a from b where x.m = y.n)
Thanks, I must be blind ...
complete solution:
update
TableA
set
ColB = (select ColE from TableB where TableA.ColA=TableB.ColD),
ColC = (select ColF from TableB where TableA.ColA=TableB.ColD)
where
ColA in (select ColD from TableB)
if you miss the where- clause all remaining rows are filled with NULL.
> ++ mcs
Andreas
-- wenn email, dann AndreasMosmann <bei> web <punkt> deReceived on Sat Oct 08 2005 - 05:00:09 CDT