update t_soft1 set softlinks = t_soft2.softlinks from t_soft1,t_soft2 where t_soft1.id = t_soft2.id
8 个解决方案
#1
update t_soft1,t_soft2 where t_soft1.id = t_soft2.id
set t_soft1.softlinks = t_soft2.softlinks
set t_soft1.softlinks = t_soft2.softlinks
#2
还是报错哦。
#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
#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
#3
update t_soft1,t_soft2 set t_soft1.softlinks = t_soft2.softlinks
where t_soft1.id = t_soft2.id
where t_soft1.id = t_soft2.id
#4
update t_soft1 set softlinks = t_soft2.softlinks from t_soft1,t_soft2 where t_soft1.id = t_soft2.id
这个MSSQL的写法,是在mysql里不支持的,改成如下:
update t_soft1 inner join t_soft2 on 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
这个MSSQL的写法,是在mysql里不支持的,改成如下:
update t_soft1 inner join t_soft2 on 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
#5
执行成功了,至为感谢,能告诉我为什么会出现这样的情况吗?Mysql和Mssql在语句的书写方面有什么不一样吗?
#6
主要是语法格式不同,可以看看MYSQL的HELP
#7
好的,谢谢!
#8
update t_soft1 set softlinks = t_soft2.softlinks from t_soft2 where t_soft1.id = t_soft2.id
你的更新数据来自表2 所以from 后面只要一个表2就可以了
你的更新数据来自表2 所以from 后面只要一个表2就可以了
#1
update t_soft1,t_soft2 where t_soft1.id = t_soft2.id
set t_soft1.softlinks = t_soft2.softlinks
set t_soft1.softlinks = t_soft2.softlinks
#2
还是报错哦。
#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
#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
#3
update t_soft1,t_soft2 set t_soft1.softlinks = t_soft2.softlinks
where t_soft1.id = t_soft2.id
where t_soft1.id = t_soft2.id
#4
update t_soft1 set softlinks = t_soft2.softlinks from t_soft1,t_soft2 where t_soft1.id = t_soft2.id
这个MSSQL的写法,是在mysql里不支持的,改成如下:
update t_soft1 inner join t_soft2 on 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
这个MSSQL的写法,是在mysql里不支持的,改成如下:
update t_soft1 inner join t_soft2 on 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
#5
执行成功了,至为感谢,能告诉我为什么会出现这样的情况吗?Mysql和Mssql在语句的书写方面有什么不一样吗?
#6
主要是语法格式不同,可以看看MYSQL的HELP
#7
好的,谢谢!
#8
update t_soft1 set softlinks = t_soft2.softlinks from t_soft2 where t_soft1.id = t_soft2.id
你的更新数据来自表2 所以from 后面只要一个表2就可以了
你的更新数据来自表2 所以from 后面只要一个表2就可以了