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

每类视频近一个月的转发量/率

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

# 统计在有用户互动的最近一个月
# 表中最新时间作为标准时间?
# 字段:类别tag / 转发量 / 播放量
# 筛选条件:时间要求在 最近时间且过往30天

select tag,sum(if_retweet) as retweet_cut,
round(sum(if_retweet)/count(if_retweet),3) as retweet_rate
from tb_user_video_log left join tb_video_info using(video_id)
where date(start_time) > 
(select date_sub(max(date(start_time)),interval 30 day) 
from tb_user_video_log)
group by tag
order by retweet_rate DESC;

全部评论

相关推荐

点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务