Re: SQL update??
From: Thomas B. Cox <tcox_at_qiclab.scn.rain.com>
Date: Thu, 26 Mar 1992 06:17:25 GMT
Message-ID: <1992Mar26.061725.7673_at_qiclab.scn.rain.com>
Date: Thu, 26 Mar 1992 06:17:25 GMT
Message-ID: <1992Mar26.061725.7673_at_qiclab.scn.rain.com>
mahesh_at_cis.ksu.edu (Mahesh Bommareddy) writes:
>Could someone please help this novice with this problem
>I have got two tables T1(field1,field2,field3) and T2(field1,field2,field3)
>. Both the tables have the same structure.
>I have to update field2 in T1 with the value of field2 in T2 where the field1
>value should be the same for both the tuples.(field1 is the unique key for
>both T1 and T2).
>Thanks a lot,
>mahesh
SQL Language Reference Manual v6, page 6-18:
Correlated Query
UPDATE table1 table_alias1
SET column =
(SELECT expr FROM table2 table_alias2 WHERE table_alias1.column = table_alias2.column)
This one baffled me too when I first needed it.
Cheers.
-- Thomas Cox (I work for Oracle, so I can't be considered impartial.) tcox_at_us.oracle.com work: 503-220-1678Received on Thu Mar 26 1992 - 07:17:25 CET