[英]Syntax error “near FROM” when using UPDATE with JOIN in MySQL?
UPDATE bestall SET view = t1.v, rawview = t1.rv
FROM bestall INNER JOIN beststat as t1
ON bestall.bestid = t1.bestid
this query gives syntax error near 此查询在附近提供语法错误
'FROM bestall INNER JOIN beststat as t1 ON bestall.bestid = t1.bestid' at line 3
any reasons? 任何原因?
That isn't valid MySQL syntax. 这不是有效的MySQL语法。 It is valid in MS SQL Server, however.
这是 MS SQL Server中有效,但是。 For MySQL, use:
对于MySQL,使用:
UPDATE
bestall
JOIN beststat AS t1 ON bestall.bestid = t1.bestid
SET view = t1.v, rawview = t1.rv
MySQL requires the update tables to come before the SET
clause. MySQL要求更新表在
SET
子句之前。 See the MySQL UPDATE
syntax reference for full details. 有关完整详细信息,请参阅MySQL
UPDATE
语法参考 。
Try it this way: 试试这种方式:
UPDATE bestall INNER JOIN beststat as t1
ON bestall.bestid = t1.bestid SET view = t1.v, rawview = t1.rv
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.