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

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

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

select b.tag,sum(a.if_retweet) as retweet_cut,
round(sum(a.if_retweet)/count(a.uid),3) as retweet_rate
from tb_user_video_log as a
left join tb_video_info as b
on a.video_id=b.video_id
where datediff(date((select max(start_time) from tb_user_video_log)),date(a.start_time))<=29
group by b.tag
order by retweet_cut desc

datediff是前减后

全部评论

相关推荐

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