题解 | #每类视频近一个月的转发量/率#

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

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

select author,month,fans_growth_rate,sum(fans)over(partition by author order by month) as total_fans
from 
(select author,substr(start_time,1,7) as month,round((sum(if_follow=1)-sum(if_follow=2))/count(1),3) as fans_growth_rate,sum(if_follow=1)-sum(if_follow=2) as fans
from tb_user_video_log t join tb_video_info t1 using(video_id)
group by author,month) t
where fans_growth_rate <>0
order by author,total_fans
全部评论

相关推荐

1 收藏 评论
分享
牛客网
牛客企业服务