Monday, January 13, 2014

How to update multiple column from another tablein oracle using single query

I was trying to find out single query to update multiple column of one table from another table based on some values. Finally I came up with following query tat work properly in oracle.

UPDATE T1
SET (T1.C1,
     T1.C2,
     T1.C3)=
  (SELECT T2.C1,
          T2.C2,
          T2.C3
   FROM T2
   WHERE T1.C4 = T2.C4
     AND T1.C5= T2.C5)