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

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

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

SELECT

author,

MONTH ( start_time ) mon,

sum( CASE WHEN if_follow = 1 THEN 1 WHEN if_follow = 2 THEN - 1 ELSE 0 END ) / count(*),

sum(

sum( CASE WHEN if_follow = 1 THEN 1 WHEN if_follow = 2 THEN - 1 ELSE 0 END )) over (

PARTITION BY author

ORDER BY

MONTH ( start_time ))

FROM

tb_user_video_log a

JOIN tb_video_info b ON a.video_id = b.video_id

GROUP BY

author,

MONTH (

start_time)

全部评论

相关推荐

Yki_:以下条件优先录用: 喜欢去缅北当猪仔的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务