SQL,小白尝试,直接求主播打赏的总金额大于100000,然后,利用窗口函数排序即可。 小白瞎写,请大佬多多指教,想的比较简单 select t1.author_id //主播ID, t1.py //主播收入总金额 from( select author_id, py, dense_rank()over(order by py desc) as m //打赏总金额排序(where 筛出大于100000的人后排名) from( select author_id, sum(total_cost) as py,//打赏主播总金额 from dashangbiao group by author_id ) as t where t.py>100000 //筛出大于100000的主播 ) as t1 where t1.m<=3
点赞 8

相关推荐

牛客网
牛客企业服务