Update table column from another table column + SQL





Note : T=Table, C=Column, C2 for T1 and T2 got same values.

 I want to update T1.C1 values from T2.C1. What would be the SQL Query.

update T1 set T1.C1=T2.C1 from T2inner join T1 on T2.C2=T1.C2

Above sql query will update all values from table 2 column 1 to table 1 column1 where table1 and table2 have same values in column2 of each table. Above query has been tested on Microsoft Sql Server and should work with MsAccess, MySQl , Oracle and all database which support SQL.





Tags: , , , , , , , , ,

Leave a Reply