91-9990449935 0120-4256464 |
SQL UPDATE with JOINSQL UPDATE JOIN means we will update one table using another table and join condition. Let us take an example of a customer table. I have updated customer table that contains latest customer details from another source system. I want to update the customer table with latest data. In such case, I will perform join between target table and source table using join on customer ID. Let's see the syntax of SQL UPDATE query with JOIN statement. How to use multiple tables in SQL UPDATE statement with JOINLet's take two tables, table 1 and table 2. Create table1 Create table2 Now check the content in the table.
Our requirement is that we have table 2 which has two rows where Col 1 is 21 and 31. We want to update the value from table 2 to table 1 for the rows where Col 1 is 21 and 31. We want to also update the values of Col 2 and Col 3 only. The most easiest and common way is to use join clause in the update statement and use multiple tables in the update statement. Check the content of the table SELECT FROM table 1 SELECT FROM table 2
Here we can see that using join clause in update statement. We have merged two tables by the use of join clause.
Next TopicSQL UPDATE DATE
|