mysql 多表连接更新 update t set t... from t inner join 报错解决
问题描述
表连接再更新的 sql 语法如下:
update t1 set t1.col2='abc' from table1 t1 INNER JOIN table2 t2 on t2.col1=t1.col1 ...
报错:
> 1064 - You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 15 column 5 near "from table1 t1 INNER JOIN table2 t2 on t2.col1=t1.col1
问题解决
update t set t... from t inner join...
这种语法是 sqlserver 的用法,mysql 不支持,而支持的语法是:
update table1 inner join table2 t on t.col1=table1.col1 ... set table1.col2='abc'
标签:
分类:
技术问题记录
本文来自【坤哥网】,转载请带上原文链接:http://www.kungge.com/kwan/6108.html