把表1的remoteid列添加到表2里面的sql语句怎么写啊
表1:userid remoteid
1 123
2 124
3 125
表2:userid address
1 A
2 B
3 C
怎么把 表一的remoteid
对应userid添加到表二里面的sql语句
[解决办法]
alter table 表2 add remoteid intupdate a set remoteid=b.remoteid from 表1 a inner join 表2 b on a.userid=b.userid
[解决办法]
----表2增加一列remoteidalter table 表2 add remoteid int---将表中remoteid值更新到表2中update a set remoteid=b.remoteid from 表1 a inner join 表2 b on a.userid=b.userid
[解决办法]
----表2增加一列remoteidalter table 表2 add remoteid int---将表中remoteid值更新到表2中update a set remoteid=b.remoteid from 表2 a inner join 表1 b on a.userid=b.userid