Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Update a table with another

Re: Update a table with another

From: Andreas Mosmann <keineemails_at_gmx.de>
Date: Sat, 08 Oct 2005 12:00:09 +0200
Message-ID: <1128765609.82@user.newsoffice.de>


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> de
Received on Sat Oct 08 2005 - 05:00:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US