当前位置: 代码迷 >> Oracle开发 >> oracle的emp表,先按薪资排序,然后查询出第三到第六行的名字,工资
  详细解决方案

oracle的emp表,先按薪资排序,然后查询出第三到第六行的名字,工资

热度:21   发布时间:2016-04-24 07:20:36.0
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.daimami.com/other/1391128.html
  相关解决方案