首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

Oracle怎么用关联查询结果更新一个表

2013-04-07 
Oracle如何用关联查询结果更新一个表oracle 11g,情况是这样的,A(id,b_id,str) B(id,str);现在通过要求是如

Oracle如何用关联查询结果更新一个表
oracle 11g,情况是这样的,A(id,b_id,str) B(id,str);现在通过要求是如果A.str=B.str,则把B.id写入A.b_id中。求高手指点一下~~~~ oracle 多表更新?关联
[解决办法]
update a set a.id = (select b.id from b where b.str = a.str) where exists(select * from b where a.str = b.str)
[解决办法]
update A set A.id = (select b.id from b where b.str = A.str) where exists(select 1 from b where A.str = b.str)

热点排行