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

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

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

select
    author,
    month,
    round(avg(f), 3) fans_growth_rate,
    sum(sum(f)) over (
        partition by
            author
        order by
            month
    ) total_fans
from
    (
        select
            author,
            date_format (start_time, '%Y-%m') month,
            case
                when if_follow > 1 then -1
                else if_follow
            end f
        from
            tb_user_video_log l
            inner join tb_video_info i on l.video_id = i.video_id
        where
            year (start_time) = 2021
    ) t
group by
    author,
    month
order by
    author,
    total_fans

全部评论

相关推荐

醉蟀:你不干有的是人干
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-15 17:24
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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