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

来源:互联网 发布:天锁斩月淘宝 编辑:程序博客网 时间:2024/05/16 01:10

已有如下两个表
table A
Acol1 | Acol2 | Acol3 | Acol4

table B
Bcol1 | Bcol2 | Bcol3 | Bcol4 | Bcol5

现在想用table B的Bcol4列去更新table A的Acol3列。


一条sql语句搞定:
update table A inner join B on A.Acol4 = B.Bcol2 set A.Acol3 = B.Bcol4 where Acol1=...