来自JOIN的更新表显示#1064

时间:2018-05-07 13:18:44

标签: mysql sql-update

我正在尝试执行此

  UPDATE product
SET Product_entr_notes = t2.note
    ,Product_entr_email = t2.email
    ,Product_entr_mobile = t2.Mobile
    ,Product_entr_phone = t2.Home_Phone
FROM product AS t1
INNER JOIN result AS t2 ON t1.id = t2.ACTID

但我得到了

  

1064 - 您的SQL语法出错;检查手册   对应于您的MariaDB服务器版本,以获得正确的语法   靠近' FROM产品t1 INNER JOIN结果t2 ON t1.id = t2.ACTID WHERE   t1.id = t2.ACTID'在第1行

1 个答案:

答案 0 :(得分:0)

您应该JOIN放在Update之后,例如:

UPDATE product t1
INNER JOIN result AS t2 ON t1.id = t2.ACTID
SET Product_entr_notes = t2.note
    ,Product_entr_email = t2.email
    ,Product_entr_mobile = t2.Mobile
    ,Product_entr_phone = t2.Home_Phone