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

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

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

select author,month,fans_growth_rate,
sum(total_fans1) over (partition by author order by month) as total_fans
from
    (select author,
    substr(start_time,1,7) as month,
    round((sum(if(if_follow=1,1,0))+sum(if(if_follow=2,-1,0)))/count(t1.id),3) as 	  	fans_growth_rate,
    sum(if(if_follow=1,1,0))+sum(if(if_follow=2,-1,0)) as total_fans1
    from tb_user_video_log t1
    left join tb_video_info t2
    on t1.video_id=t2.video_id
    group by author,substr(start_time,1,7)) t3
where t3.total_fans1 !=0
order by author,total_fans;

这个题的坑就是要把涨粉为0的数据剔除

全部评论

相关推荐

StephenZ_:我9月份找的第一段实习也是遇到这种骗子公司了,问他后端有多少人和我说7个正职,进去一看只有一个后端剩下的都是产品前端算法(没错甚至还有算法)。还是某制造业中大厂,我离职的时候还阴阳怪气我
点赞 评论 收藏
分享
链接
海梨花:我说话难听,你这简历跟没写没啥区别,搜搜别人的简历,用心写,不要随随便便就结束了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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