Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Update statement syntax?
HoMan wrote
>The UPDATE statement in Transact-SQL can take the form:
>UPDATE tableA
> Set col = <expression>, ...
> FROM TableB, TableC
> WHERE <condition> ;
update tableA a
set ( a.col1, a.col2 ) =
( select b.col3, c.col4
from tableB b, tableC c where b.id1 = a.id1 and b.id2 = c.id2
( select d.col1
from tableD d where d.id1 = a.id2
( select max( e.col1 )
from tableE e
)
and ( a.col4, a.col5 ) =
( select f1.col1, f1.col2
from tableF f1 where f1.id1 = a.id3
( select distinct f2.col3
from tableF f2 where f2.id2 = a.id3
Get the picture? :-)
The only thing you cannot do is update two tables in one statement, like
update tableA a, tableB b
set a.col1 = ..., b.col1 = ...
where a.col3 = b.col4;
Arjan. Received on Sat Feb 20 1999 - 05:48:41 CST