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

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

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;

全部评论

相关推荐

MingoTree:看不出你你的技术栈,想找什么工作,然后课设项目别写上去了,自我评价删了,前后端你想好你要干啥,这种简历投上去秒挂的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务