现在有两张表t_soft1,t_soft2,这两张表有两个相同名称的列id,softlinks,其中id为主键并且两张表的id列数据完全相同。我现在想把t_soft2的softlinks列的数据覆盖t_soft1的数据。在MSSql我用下面的语句成功实现,但在MySql环境中用PhpAdmin就报错,请问是什么原因?
update t_soft1 set softlinks = t_soft2.softlinks from t_soft1,t_soft2 where t_soft1.id = t_soft2.id
update t_soft1 set softlinks = t_soft2.softlinks from t_soft1,t_soft2 where t_soft1.id = t_soft2.id
set t_soft1.softlinks = t_soft2.softlinks
#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 'where t_soft1.id = t_soft2.id set t_soft1.softlinks = t_soft2.softlinks' at line 1
where t_soft1.id = t_soft2.id
set t_soft1.softlinks = t_soft2.softlinks 或update t_soft1,t_soft2 set t_soft1.softlinks = t_soft2.softlinks
where t_soft1.id = t_soft2.id
执行成功了,至为感谢,能告诉我为什么会出现这样的情况吗?Mysql和Mssql在语句的书写方面有什么不一样吗?
你的更新数据来自表2 所以from 后面只要一个表2就可以了