MySQL UPDATE syntax with multiple tables using WHERE clause

后端 未结 4 1652
刺人心
刺人心 2020-11-30 12:37

Case:

How to update table1 with data from table2 where id is equal?

Problem:

When I run the following upda

4条回答
  •  长情又很酷
    2020-11-30 13:02

    here's the correct syntax of UPDATE with join in MySQL

    UPDATE  table1 a
            INNER JOIN table2 b
                ON a.ID = b.ID
    SET     a.value = b.value 
    
    • SQLFiddle Demo

提交回复
热议问题