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

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

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

WITH t1 AS (
select tag,
      DATE_FORMAT(start_time,"%Y-%m-%d")as dt,
      sum(sum(if_like)) over (partition by tag order by date_format(start_time,"%Y-%m-%d") rows 6 preceding) as sum_like_cnt_7d,
      max(sum(if_retweet)) over (partition by tag order by date_format(start_time,"%Y-%m-%d") rows 6 preceding) as max_retweet_cnt_7d
      from tb_user_video_log as u
      left join tb_video_info as v 
      on u.video_id = v.video_id 
      where datediff("2021-10-03",date(start_time))<9
--       where datediff(date((select max(start_time) from tb_user_video_log)),date(start_time))<9
      group by dt,tag 
      order by dt 
)
select * from t1 where dt BETWEEN "2021-10-01" and "2021-10-03" order by tag desc ,dt asc;

全部评论

相关推荐

“校招”、“3-5年经验”
xiaolihuamao:逆向工程不是搞外挂的吗,好像现在大学生坐牢最多的就是诈骗罪和非法侵入计算机系统罪,发美金,还居家办公,就是怕被一锅端,
点赞 评论 收藏
分享
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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