日期:2014-05-17  浏览次数:20869 次

oracle的emp表,先按工资排序,然后查询出第三到第六行的名字,工资
select * from (select rownum as r, ename,sal from emp order by sal) where r>=3 and r<=6;
--结果应该是1100,1250,1250,1300
--上边的语句是不是先排序的 结果 1250 1250 2850 2975 
select * from (select ename,sal from emp order by sal) where rownum >=3 and rownum <=6;
--未选定行  
网上也查了,但是没找到解决的办法,真心求指导

------解决方案--------------------
select ename,sal from ( 
select ename,sal,rownum rn from ( 
select ename,sal from emp order by sal
) where rownum<=6
) where rn>=3
我的异常网推荐解决方案:软件开发者薪资,http://www.aiyiweb.com/other/1391128.html