Skip to main content

Posts

Showing posts with the label update column from another table

Update column with data from another table in SQL

  At different point of time we come up with a situation  where we need to update a column in a table from another  table based on some condition.   So a Basic Syntax for update is: UPDATE table SET column1 = expression1, column2 = expression2, ... [WHERE conditions]; For us to update based on another table we will be using the same syntax for update applying join with another table from  where we need the data. UPDATE t1 SET t1 .column_to_update = t2 .column_from_update FROM Table1 t1 INNER JOIN Table2 AS t2 ON t1 .common_column = t2 .common_column