5
UPDATE bestall SET view = t1.v, rawview = t1.rv 

FROM bestall INNER JOIN beststat as t1

ON bestall.bestid = t1.bestid

此查询在附近给出语法错误

 'FROM bestall INNER JOIN beststat as t1 ON bestall.bestid = t1.bestid' at line 3

有什么理由吗?

4

2 回答 2

6

这不是有效的 MySQL 语法。但是,它在 MS SQL Server中有效。对于 MySQL,使用:

UPDATE 
  bestall
  JOIN beststat AS t1 ON bestall.bestid = t1.bestid 
SET view = t1.v, rawview = t1.rv

MySQL 要求更新表在SET子句之前。有关完整详细信息,请参阅MySQLUPDATE语法参考

于 2012-04-21T19:38:06.337 回答
1

试试这种方式:

UPDATE bestall INNER JOIN beststat as t1
ON bestall.bestid = t1.bestid SET view = t1.v, rawview = t1.rv 
于 2012-04-21T19:37:52.077 回答