Syntax error "near FROM" when using UPDATE with JOIN in MySQL?
mysql, sql, syntax-error
Solution
That isn't valid MySQL syntax. It is valid in MS SQL Server, however. For MySQL, use:
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. See the MySQL `UPDATE` syntax reference for full details.
Problem
``` 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?