*********ORACLE的表更新****************
关于2个表的更新
aaa表有2个字段
aid aname
1 张
2 王
bbb表也有2个字段
bid bname
1 NULL
2 NULL
请问怎么按ID更新bbb表的内容。如果是SQLSERVER数据库我可以这样写:
update bbb set bname = a.aname from aaa a where a.aid = bbb.bid
请问ORACLE怎么更新方便!!!!谢谢!!!
------解决方案--------------------update bbb b
set b.bname =
(select a.aname from aaa a
where a.aid = b.bid
)
where exists
(
select 1 from aaa a
where a.aid = b.bid
)
------解决方案--------------------update bbb set bname = (select aname from aaa where aid = bbb.bid)
------解决方案--------------------见见老朋友:)