sql语句联表更新(从一个数据库中的一张表更新到另一个数据库的另一张表)


一、sql server数据库写法:

update a set a.ksgmm=b.ksgmm,a.ksgm=b.ksgm,a.scztm=b.scztm,a.sczt=b.sczt from landsde.sde.jszb a,kyqcldb.dbo.kcl_ksjj b 
where a.nd=b.nd and a.kqbh=b.kqbh and a.djflbh =b.djflbh

其中landsde.sde.jszb、kyqcldb.dbo.kcl_ksjj是不同数据库下的不同数据表

 

二、oracle写法

update usertab a set (a.name, a.age)= (select b.name, b.age from member b where a.id=b.id)

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM