如果想从表中取出按照某字段排序前M到N条记录
SQL> select ID from
( select ID , rownum as con from
( select ID from TestSort order by ID
)
where rownum <= 3 /*N值*/
)
where con >= 2; /*M 值*/
SQL> select ID from
( select ID , rownum as con from
( select ID from TestSort order by ID
)
where rownum <= 3 /*N值*/
)
where con >= 2; /*M 值*/
解决方案 »
- Oracle补充日志(supplemental log)如何启动,停止,如何查看其启用状态?
- 求sql语句:怎么快速得到一个表中的行数
- 请教删除时的子查询问题~
- VB给OARCLE的存储过程中的INT类型赋值时,应该写adinteger还是adnumeric还是别的?
- 在ORACLE中建表时,是不是表只能有一个列的类型是long?为什么?
- 在.net中如何调用oracle的存储过程
- 各位帮忙? up有分!
- 知如何去分配权限 ???,在哪里分配???
- 一个合并结果集的问题
- Oracle语句运行速度很慢
- 如何复制表?要求表的结构、什么约束、主键等条件都一样!
- 谁有Oracle8.1.7在Redhat Linux 9 安装文档,绝对给分,在线等待,急!
where rownum <(select count(*)+1 from table )
and rownum>(select count(*)-3 from table )
很详细了!
select * from (select *,rownum from you_table where rownum<m+m+1)
where rownum>m-1 and rownum<m+m+1
但有个问题:
为什么我的where后面的rownum>7不起作用?
select * from t_mygod
where rownum < (select count(*)+1 from t_mygod )
and rownum>(select count(*)-3 from t_mygod )
/
结果为 未选定行
为啥rownum<x 可以执行 而 rownum>x却不能执行?
请指教
select * from t_mygod
where rownum>3
/
未选定行 可我t_mygod里有10条记录。为什么呢?
where rownum>3
只能是<3,不能选大于号