Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Correlated updates.
Try update subquery:
UPDATE (SELECT TableA.Ref, TableB.Newref
FROM TableA, TableB WHERE TableA.Ref = TableB.Oldref)SET Ref = Newref;
-- Sergei Didur Mark Hunter <mark_at_se7en.demon.co.uk> wrote in article <348a688e.266552_at_news.demon.co.uk>...Received on Wed Dec 10 1997 - 00:00:00 CST
> I wonder if you could help me with a piece of SQL?
>
> TableA has a column called Ref, which is unique.
> TableB has columns called Oldref and Newref.
>
> For every value of TableA( Ref) there is a corresponding value in
> TableB( Oldref)
>
> I wish to update every row in TableA so that the value of Ref is
> updated to Newref (as listed in TableB).
>
>
> Suggestions please.
> Mark Hunter
> http://www.se7en.demon.co.uk
>
![]() |
![]() |