题解 | #每类视频近一个月的转发量/率#
每类视频近一个月的转发量/率
https://www.nowcoder.com/practice/a78cf92c11e0421abf93762d25c3bfad
select tag,sum(if_retweet) as retweet_cut, round(sum(if_retweet)/count(*),3) as retweet_rate from tb_user_video_log join tb_video_info using(video_id) where datediff('2021-10-1',start_time)<30 group by tag order by retweet_rate desc
重点在于理解题目中给到的实践范围。
datediff('2021-10-31','2021-10-2') =29
所以在从2021-10-1号往前推,时间间隔是小于30,不是<=30
[[日期函数]]