首页 > 代码库 > oracle取分组的前N条数据

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;

 

 

http://bbs.csdn.net/topics/350001717 

oracle取分组的前N条数据