过着简单,真实的生活,喜欢收藏变形金刚(TFE,G1,SL系列),研究金融股市,KOF98,篮球,学习研究Oracle技术,我并不是一个全职的Oracle DBA,但是对于Oracle技术的热爱和研究,是一个不争的事实,愿意结交广大Oracle技术爱好者!MSN:oracle_kof_tf@hotmail.com
Update 多个关联表SQL的写法
上一篇 /
下一篇 2007-12-10 18:49:58
/ 个人分类:Oracle数据库技术-SQL
更新一列:
update mytab a set name=(select b.name from goal b where b.id=a.id)
where exists (select 1 from goal b where b.id=a.id);
更新多列:
update mytab a
set (name,address)=(select b.name,b.address
from goal b
where b.id=a.id)
where exists (select 1
from goal b
where b.id=a.id )
特别是要注意exists后面的语句:)这会让目标行不至于为NULL
导入论坛
引用链接
收藏
分享给好友
推荐到圈子
管理
举报
TAG: