如果选择一定范围内的记录 select * from table1 where ccccc order by time desc选择出来了一些数据。我想选择其中的第101条到200条。请问sql语句怎么写?是利用rownum在上面的sql语句外面做嵌套么?谢谢大家。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from (select rownum r, a.* from (select * from table1 where ccccc order by time desc) a) where a.r < 201 and a.r > 100;就是合理的利用rownum select * from (select t.*,rownum rn from table1 t where ccccc order by time desc)where rn between 101 and 200 原有的sql语句不做修改。那是不是一定要外面嵌套两层? select * from table1 where ccccc order by time desc where rownum <=200minusselect * from table1 where ccccc order by time desc where rownum <101; 里层的rownum是order by之前的序号吧? select * from table1 where ccccc order by time desc where rownum <=200这句SQL只是找出ccccc表中的前200条记录,再进行time的倒序,而不是先进行time的倒序,再取前200条记录。所以这种方法可能得到的数据不准确! 外嵌套,因为rownum是结果集出来后生成的。 oracle查詢變慢 数据表操作问题? 着急,sql优化问题~求高手 有关胖客户端的本地数据库问题 Oracle中如何插入大数据量记录 下载的oracle 怎么安装成英文版 oracle安装错误(急 急 急) 为什么Oracle书上的SQL都没有schema? 另类:linux下的oracle数据库如何到处到access。 请教各位一个system用户修改的问题?谢谢! oracle数据库怎么导入表 oracle语句效率比较。
from (select rownum r, a.*
from (select * from table1 where ccccc order by time desc) a)
where a.r < 201
and a.r > 100;就是合理的利用rownum
(select t.*,rownum rn from table1 t where ccccc order by time desc)
where rn between 101 and 200
minus
select * from table1 where ccccc order by time desc where rownum <101;
里层的rownum是order by之前的序号吧?
这句SQL只是找出ccccc表中的前200条记录,再进行time的倒序,而不是先进行time的倒序,再取前200条记录。所以这种方法可能得到的数据不准确!