Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Update multiple columns from multiple tables in a single UPDATE Query

user5534771Jul 18 2014 — edited Jul 18 2014

Good Morning,

I am trying to figure out if I am heading in the the right direction.

I want to update multiple columns from multiple tables in a single UPDATE query. Also, I would like to update multiple columns in one table from multiple tables.

Scenario 1

UPDATE Table2, Table 3

SET T2.Column1 = T1.Column1

,T2.Column2 = T1.Column2

,T3.Column2 = T1.Column2

FROM Table1 T1, Table2 T2, Table3 T3

WHERE T1.id = T2.id

and T1.id = T3.id

Scenario 2

UPDATE Table3

SET T3.Column1 = T1.Column1

T3.Column2 = T1.Column2

,T3.Column3 = T2.Column3

,T3.Column4 = T2.Column4

FROM Table1 T1, Table2 T2, Table3 T3

WHERE T3.id = T1.id

and T3.id = T2.id

This post has been answered by Frank Kulash on Jul 18 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 15 2014
Added on Jul 18 2014
9 comments
18,697 views