oracle取分组的前N条数据
select * from
(
select animal,age,id,
row_number()over(partition by animal order by age desc) row_num
from zoo
)
where row_num <=5;
select * from
(
select animal,age,id,
row_number()over(partition by animal order by age desc) row_num
from zoo
)
where row_num <=5;