select t.*,
row_number() over(partition by t.class order by t.class desc,t.sal desc ) sort
from (
select '5' as id,'李四' as name,1 as class,'2023-05-09' as create_date,9000 as sal
union all
select '4' as id,'张三' as name,1 as class,'2023-05-08' as create_date,8000 as sal union all
select '17' as id,'a' as name,2 as class,'2023-05-11' as create_date,60000 as sal union all
select '6' as id,'王五' as name,2 as class,'2023-05-10' as create_date,120000 as sal union all
select '7' as id,'赵六' as name,3 as class,'2023-05-11' as create_date,9000 as sal
) t