搜索墙首页  编程技术  java  asp  ajax  php  c/c#/c++  数据库  oracle  mysql  db2  操作系统  windows  linux  股吧
首页 > 编程 > 数据库 > oracle
 1         
1楼  fhuibo 2007-08-24 11:07:19

关于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怎么更新方便!!!!谢谢!!!
2楼  icedut 2007-08-24 12:13:20

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
)
3楼  ningzhengping 2007-08-28 14:03:11

update   bbb   set   bname   =   (select   aname   from   aaa   where   aid   =   bbb.bid)
4楼  Elysium 2007-10-25 15:22:25

见见老朋友:)
 1         
您的发言将按有关规定都会存档,您须为所发表后果负责,请您遵纪守法并注意语言文明。
标题:*********ORACLE的表更新****************
热门关注
标题回复点击
Oracle 10g (ASM):Sample Implementation0743
Oracle 正版用户授权0692
动态性能视图(Dynamic perfermance view V$)0686
EM 无法启动&&重新完全配置EM0560
小布老师Oracle 9i DBA Fundamentals II0345
ORA-1652: unable to extend temp segment诊断以及解决0308
缓冲处理器 buffer handle0275
locate pl/sql bottleneck0271
OracleDBConsole 服务因 2 (0x2) 服务性错误而停止。请问一下如何解决!2267
L1:Buffer Cache0264
搜索墙@2009 www.pkwall.com all rights reserved QQ:276471788 [京ICP备09111534号]
声明:本站部分数据来源于网络,仅供参考,如有版权问题,请联系我们,我们将及时删除!转载本站请注明来源