Thursday, February 6, 2014

Update multiple table rows from another table SQL

   UPDATE table1 t1
   SET (column1,column2) = (SELECT t2.value1 ,t2.value2
                         FROM table2 t2
                        WHERE t1.id=t2.id)
   WHERE EXISTS (
      SELECT 1
      FROM table2 t2
      WHERE WHERE t1.id=t2.id )
 
http://stackoverflow.com/questions/7030699/oracle-sql-update-with-data-from-another-table

No comments:

Post a Comment