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

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

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

with t1 as(select tag,
DATE_FORMAT(start_time,'%Y-%m-%d') as dt,
sum(if_like) as like_cnt,
sum(if_retweet) as retweet_cnt
from tb_video_info join tb_user_video_log
using(video_id)
group by tag,dt
order by tag,dt),

t2 as(select tag,dt,
sum(like_cnt) over (PARTITION by tag order by dt rows 6 preceding)	sum_like_cnt_7d,
max(retweet_cnt) over (partition by tag order by dt rows 6 preceding) max_retweet_cnt_7d
from t1)

select * from t2
where dt between '2021-10-01' and '2021-10-03'
order by tag desc,dt

全部评论

相关推荐

不愿透露姓名的神秘牛友
07-03 17:37
点赞 评论 收藏
分享
06-12 10:50
门头沟学院 Java
你的不定积分没加C:我怎么在学院群看到了同样的话
点赞 评论 收藏
分享
醉蟀:你不干有的是人干
点赞 评论 收藏
分享
这不纯纯作弊了吗😢😢😢
编程界菜鸡:信这个的这辈子有了,这智商你靠啥都没用
你找工作的时候用AI吗?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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