How to use mysql update with inner join, Mysql Update query

The SQL UPDATE Statement
The UPDATE statement is used to update existing records in a table.

syntax:

UPDATE [table1_name] AS t1 
INNER JOIN [table2_name] AS t2 
ON t1.[column1_name] = t2.[column1_name] 
SET t1.[column2_name] = t2.[column2_name] where condition;

Example: 

UPDATE employees em
INNER JOIN  Mark ON em.Grade = Mark.Grade
SET em.salary = em.salary + em.Grade/ percentage;

Post a Comment

0 Comments