用一个表的字段更新另一个表的字段

update yz_posts set yz_posts.author=yz_threads.author from yz_threads,yz_posts where yz_threads.tid=yz_posts.tid

我用这SQL代码执行说语法错误。

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from yz_threads,yz_posts where yz_threads.tid=yz_posts.tid' at line 1

是不是版本的问题还是语法的问题
phpMyAdmin 2.7.0-pl1

我目的是想把一个表的字段覆盖到另外一个表的字段,条件是tid相同。
这代码我用过,一样返回#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from yz_posts inner join yz_threads on yz_threads.tid=yz_posts.tid' at line 1

update yz_posts set yz_posts.author=yz_threads.author from yz_posts inner join yz_threads on yz_threads.tid=yz_posts.tid

mysql的语法不清楚。
温馨提示:答案为网友推荐,仅供参考
相似回答