select r,e1.*
from (select rownum r,e1.*
from (select empno,ename,sal from emp order by sal desc ) e1
where rownum<=8) e2
where r >4
这样不行?
select r,e2.*
from (select rownum r,e1.*
from (select empno,ename,sal from emp order by sal desc ) e1
where rownum<=8) e2
where r >4
这样就可以了??
select r,e1.* from (select rownum r ,e1.* from ( select empno ,ename ,sal from emp order by sal desc ) e1 where rownum<=8 ) e2 where r >4
e1 是最内侧的
e2 是中间层
最外层select 查出结果。
select r,e1.* from (select rownum r ,e1.* from ( select 中间还隔着一层,所以不可以e1
select rownum,e1.* 开头没问题 如果代入 R 的话 结合后面 where r>4 最后会出来两排R参数
你看是 以谁为主表 你第一个查询的 是 e1.* 而e1表在 子表里面