小白求解:with cte as( select user_id from rewards group by user_id having sum(total_cost) > 10000 ) select author_id,sum_total_cost from( select author_id,sum_total_cost,dense_rank() over (order by sum_total_cost desc) as rk from( select author_id,sum(total_cost) as sum_total_cost from cte left join rewards using(user_id) group by author_id ) t1 ) t2 where rk <= 3;
点赞 2
牛客网
牛客企业服务