SELECT b3.id AS user_id, b3.name, b3.grade_num FROM ( SELECT b1.id, b1.name, (b1.totalgrade_add-b2.totalgrade_reduce) AS grade_num, DENSE_RANK() OVER (ORDER BY (b1.totalgrade_add-b2.totalgrade_reduce) DESC) AS ranking FROM ( # b1: 筛选需要add的分数 SELECT U.id, U.name, SUM(...