Update 的问题,想将表2中oem的数据更新到表1中,关键词是finance_no
到网上看了下开始找到的是mysql的语句,它的更新时可以用以下方法
update table1,table2
set table1.oem=table2.oem
where table1.finance_no=table2.finance_no
这个方法看上去很直观,但我的数据库是mssql的,可以用到下面的方法。
子查询法:
update table1
set table1.oem=(select oem from table2 where table2.finance_no=table1.finance_no)
有没有其它方法呢,了解后再更新上来。
有愿意留下脚印的,帮顶下。