select * from criss_sales; 通过rank().dense_rank().row_number()对记录进行全排列.分组排列取值但有时候,会遇到空值的情况,空值会影响得到的结果的正确性,如下所查. select dept_id ,sale_date ,goods_type ,sale_cnt ,rank() over (partition by dept_id order by sale_cnt desc) from criss_sales; 我们可以看到部门D01中的销…