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 

posted @ 2014-12-31 09:21  hmilyjch  阅读(355)  评论(0编辑  收藏  举报