Update From Another Table MySQL

Update From Another Table MySQL

We can update another table with the help of the inner join.

UPDATE
    TableName1
SET
    TableName1.col1 = TableName2.col1,
    TableName1.col2 = TableName2.col2
FROM
    Some_Table AS TableName1
    INNER JOIN Other_Table AS TableName2
        ON TableName1.id = TableName2.id
WHERE
    TableName1.column3 = 'Yes'
Please follow and like us:
Content Protection by DMCA.com