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)
多看一行书,就少写一行代码,记录点滴,用心生活。
原文地址:https://www.cnblogs.com/aegisada/p/4333486.html