题解 | #刷题通过的题目排名#
刷题通过的题目排名
http://www.nowcoder.com/practice/cd2e10a588dc4c1db0407d0bf63394f3
法一:不用窗口函数确定排名
with t as(select id,number,(select count(distinct number) from passing_number p2 where p1.number <= p2.number) as t_rank from passing_number p1) select * from t order by t_rank,id; #法二:通过窗口函数排名 select * from(select *,dense_rank()over(order by number desc) as t_rank from passing_number) t order by t_rank,id;