with a as
(select id,score from i_w)
,b as (select if(rank() over(order by score desc)<=3,id,'其它') as rid , score from a)
,c as (select rid,sum(score) as score from b group by rid)
select * from c
mysql top n
最新推荐文章于 2024-09-09 23:37:05 发布
with a as
(select id,score from i_w)
,b as (select if(rank() over(order by score desc)<=3,id,'其它') as rid , score from a)
,c as (select rid,sum(score) as score from b group by rid)
select * from c