create table test (id int, c_no int, c_num int);insert into test select 1,10001,20 from dual;
insert into test select 2,10001,30 from dual;
insert into test select 3,10001,40 from dual;
insert into test select 4,10001,100 from dual;
insert into test select 5,10001,20 from dual;
insert into test select 6,10001,40 from dual;
insert into test select 7,10001,30 from dual;
insert into test select 8,10001,50 from dual; commit;需求:id从1开始排序,取c_num小于等于60的数据,如下:
---------
1,10001,20
2,10001,30
3,10001,40
求高手帮忙,很急!
解决方案 »
- oracle触发器怎么写,,在线等!!!!!!!!!
- 安装的10g怎么登录啊~~~~~~
- linux 服务器有个vim的进程占了99%的cpu,属于oracle用户的,被我kill。求原因及后果
- oracle 索引问题
- oracle10安装 There were errors loading the aggregates
- Oracle数据库一个表中有一个字段是blob类型的,如何将blob中的数据导出成文件?
- otl获取sql影响记录数
- 一个很棘手的问题
- 【请教】为什么我的Function、Procedure里面不能用NULL
- {求助:}oracle调用webservices出现的问题
- java程序远程连接oracle数据库
- 求某一年的第一周的第一天的算法
这样行吗?
1,10001,20
2,10001,30
3,10001,40下面的我是不需要的
4,10001,100
5,10001,20
insert into test select 6,10001,40
insert into test select 7,10001,30
insert into test select 8,10001,50
select id,c_no,c_num,nvl(lag(c_num) over(order by id),10) c_num1 from test
)
select * from test1 where c_num=c_num1+10;
可为
select id,c_no,c_num,lag(c_num,1,10) over(order by id) c_num1 from test
select *
from test t
where t.c_num <= 60
and id < (select min(id) from test t where t.c_num > 60);