cume_dist(),允许并列名次复制名次自动空缺,取并列后较大名次,结果如22355778……
Posted fanweisheng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cume_dist(),允许并列名次复制名次自动空缺,取并列后较大名次,结果如22355778……相关的知识,希望对你有一定的参考价值。
将score按ID分组排名:cume_dist() over(partition by id order by score desc)*sum(1) over(partition by id)
将score不分组排名:cume_dist() over(order by score desc)*sum(1) over()
select id,area,score,
sum(1) over() as 总数,
sum(1) over(partition by id) as 分组个数,
(cume_dist() over(partition by id order by score desc))*(sum(1) over(partition by id)) 分组id排序,
(cume_dist() over(order by score desc))*(sum(1) over()) 不分组排序
from students order by id,area
以上是关于cume_dist(),允许并列名次复制名次自动空缺,取并列后较大名次,结果如22355778……的主要内容,如果未能解决你的问题,请参考以下文章