update test1 set sales=(select sales from test2 where code=002);
解决方案 »
- 菜鸟提问:Oracle事务自动提交关闭的前提下,CRUD操作时会发生事务的自动提交吗 ?
- 64位win7 系统怎么装32位oracle 11g
- wh62592855 请求联系方式 ?
- oracle windows 32bit版本运行在Windows server 64bit版本上的问题,求救
- 在Win2003SerE下安装oracle10gforWin32过程中的问题
- varchar2(N)中这个N的大的话,会不会多占用空间
- 超级初学者问!!package
- 初学ORACLE,看那本书比较好啊!!!!!!!!!!!!!!!!!
- 2000Professional下不能安装Oracle8.0.6客户端,内存不能写,怎么处理?在线等候
- 有关oracle的高级异常!
- 急急急,ORACEL 8.0.5问题
- 关于2个表联合查询出不相同的记录集?
where test1.code=test2.code;
update tes1 set sales=(select sales from test2) where test1.code=test2.code;
create table test3 as select test1.code,test1.mc,test2.sales from test1,test2 where test1.code=test2.code
如果你只想在test1的sales为null时才用test2的sales,就可以这样写:
create table test3 as select test1.code,test1.mc,decode(test1.sales,null,test2.sales,test1.sales) from test1,test2 where test1.code=test2.code
这样,就可以得到一个表test3,这里面是你想要的数据
重新创建表也是一种方案
但是有没有想过别的方案
对sql大家又真正的掌握了多少?
下面这个例子是不是符合大家的要求?特别是大量数据的更新http://www.itpub.net/showthread.php?s=&threadid=45822