select row_number()over( order by ID desc ),
max(S) from EMPLOYEE group by ID order by ID DESC
OFFSET 2 ROWS
FETCH NEXT 1 ROWS ONLY
答案 0 :(得分:1)
试试这个
with cte
as
(
select SeqNo = row_number()over( order by S desc ),* from EMPLOYEE
)
select * from cte where SeqNo = 2
答案 1 :(得分:1)
检查
select empno
from
(
select empno, rownum as rownum
from (
select empno
from emp group by id
order by id desc
)
)
where rownum=2;
答案 2 :(得分:0)
使用offset和fetch
select id, max(S) from EMPLOYEE group by ID order by 2 DESC
OFFSET 1 ROWS
FETCH NEXT 1 ROWS ONLY;