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

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

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

select author, month, fans_growth_rate, sum(delta_fans)over(partition by author order by month rows between unbounded preceding and current row) total_fans
from (select author,date_format(start_time,'%Y-%m') month,round(avg(case if_follow when 1 then 1 when 2 then -1 else 0 end),3) fans_growth_rate,sum(case if_follow when 1 then 1 when 2 then -1 else 0 end) delta_fans
from tb_user_video_log a left join tb_video_info b using(video_id)
where year(start_time)=2021
group by author,month) tab1
order by author,total_fans

累计问题

全部评论

相关推荐

07-29 14:49
门头沟学院 Java
ResourceUt...:浙大✌️吉祥
点赞 评论 收藏
分享
学一下吧现在太菜了:和简历没关系,你是清华的他就要了。多投投就行了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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