题解 | #每个创作者每月的涨粉率及截止当前的总粉丝量#

每个创作者每月的涨粉率及截止当前的总粉丝量

http://www.nowcoder.com/practice/d337c95650f640cca29c85201aecff84

笨蛋方法,要求什么就搞什么
select author,m,r fans_growth_rate,sum(s) over(partition by author order by m) total_fans
from(
select author,m,sum(if_follow) s,round(sum(if_follow)/count(*),3) r
from(
select author,date_format(start_time,'%Y-%m') m,case when if_follow=2 then -1 else if_follow end if_follow
from tb_user_video_log l
join tb_video_info i on l.video_id=i.video_id
where year(start_time)=2021
) a
group by author,m
    ) b
order by author,total_fans
    
全部评论

相关推荐

看起来名字可以很长:笑死 我暑期实习阿里云的意向也被 qq 邮箱放在垃圾箱了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务