select *from (select a1.*,rownum rwn from (select * from emp) a1 where rownum<=10) where rwn>=6;
为什么一定要把rownum<=10放在前面,把rwn放在后面,互换为什么查询不了?
还有就是前面要用rownum,而后面一定要用rwn才可以查询出来?
select * from (
select a1.*, rownum rwn from emp a1 where rownum <=10
) where rwn >= 6;
或者
select * from (
select qx.*,row_number() over(order by qx.empno) rwn from emp qx
) where rwn between 6 and 10