请教一个sqlserver子相关的update语句。
desc t_dmxxb
dmdm
dmmc
sfdm
gjbz
update t_dmxxb a set a.sfdm=
(select b.dmdm from dmxxb b where a.sfdm=b.dmmc)
where a.gjbz= '0 '
如上是oracle相同表的的子查询更新,想问要是用sqlserver怎么实现?
谢谢!
------解决方案--------------------update t_dmxxb set sfdm = b.dmdm
from t_dmxxb a
inner join t_dmxxb b on a.sfdm = b.dmmc
where a.gjbz = '0 '
------解决方案--------------------update t_dmxxb
set sfdm = b.dmdm
from t_dmxxb a,(select * from t_dmxxb) b
where a.sfdm = b.dmmc and a.gjbz = '0 '