日期:2014-05-16  浏览次数:20439 次

Oracle中的聚合函数 rank()
rank() over(partition by A order by B asc|desc)
A为分集字段,B为集内排序字段

典型案例:
找出某个日期每个营业部内资产数额排名前两位的顾客
select * from (select rank() over(partition by branch_no order by asset desc) rk,account,asset from aa.asset)
where rk<=2