题解 | #国庆期间每类视频点赞量和转发量#

国庆期间每类视频点赞量和转发量

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

select * from (
	select tag, dt,
	sum(like_total) over(partition by tag ORDER BY dt rows 6 preceding) as sum_like_cnt_7d,
	max(retweet_total) over(partition by tag ORDER BY dt rows 6 preceding) as max_retweet_cnt_7d
	from (
		select tag, sum(if_like) as like_total, sum(if_retweet) as retweet_total, date(start_time) as dt
		from tb_video_info a
		left join tb_user_video_log using(video_id)
		WHERE DATE(start_time) BETWEEN '2021-09-25' AND '2021-10-03'
		group by tag, date(start_time)
	) t
) t2
where dt >= '2021-10-01' and dt <= '2021-10-03'
group by tag, dt
order by tag desc, dt asc

逆天的题 坑一堆

全部评论

相关推荐

现在才开始投还有可能吗😭😭😭
牛客621925249号:开秋招了已经
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务