Monday, 11 January 2016

SQL - Adding a column in table from another table based on common column data in both table

We need to update values in table1 with data from table2 where common_column is the present in both tables and data should be updated based on this :

update table1 tl set table1_column=(select v.table2_column from table2 v where v.common_column= tl.common_column) where tl.table2_column is not null;  -- here condition can be any other condition 

No comments:

Post a Comment