update a1 P set(col1,col2)=(select col1,col2 from a2 Q where P.col1=Q.col1)
解决方案 »
- |zyciis| Update整个表3小时没反应,改为分段更新 为什么一条Update语句,越执行越慢呢?
- 根据Oracle中字符串统计天数
- over函数
- oracle shutdown immediate 报错!
- 一个关于varchar2字段长度的问题,请教!!
- oracle8i可以使用高级复制功能吗?
- 晕:system居然能修改sys的密码,是什么地方出问题了?郁闷。。。。。。。。。。。。。。。
- 关于时间函数Month_Between的用法,急!
- 指定回滚段问题????????
- select index_meg_seq.nextval from table 是什么意思?
- 300M的数据文件如何用数据库处理?
- 这个查询怎么写?
where exists (select 1 from a2 Q where P.col1=Q.col1)
where exists (select 1 from a2 Q where P.col1=Q.col1)你后面的where条件是做什么用的?
where exists(select col1 from a2 where p.col1=q.col1)
col1 col2
a1 1
a2 1
a3 1表a2:
col1 col2
a1 4
a2 2
a3 10两张表如上,我想把a2中字段col2的值小于8的更新到a1中,怎么写,调了半天了都搞不好,郁闷死了
set col2 = (select q.col2 from a2 q where p.col1 = q.col1 and q.col2 < 8 )
wehre exists (select 1 from a2 x where p.col1 = x.col1 and x.col2 < 8 )
set a.col2=b.col2
from a1 a,a2 b
where a.col1=b.col1 and b.col2<8
update a1
set a.col2=b.col2
from a1 a,a2 b
where a.col1=b.col1 and b.col2<8
简便,快捷,易理解!顶!顶!!