写完要长脑子了。。。。。 select author,`date`,fans_growth_rate,sum(total)over(partition by author order by `date`) total_fans from (select distinct author,`date`,round(sum(if_follow)over(partition by author,`date` order by `date`)/count(*)over(partition by author,`date` order by `date`),3) fans_growth_rate,sum(if_follow)over(partition by author,`date` order by `date`) total from (select t1.video_id,author,(case when if_follow=0 then 0 when if_follow=1 then 1 else -1 end) if_follow,date_format(start_time,'%Y-%m') `date` from tb_user_video_log t1 left join tb_video_info t2 on t1.video_id=t2.video_id where year(start_time)=2021) t3) t4 order by author,total_fans