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

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

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

select
*
from(
    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 between 6 preceding and current row) as sum_like_cnt_7d
    ,max(sum(if_retweet)) over(partition by tag order by date_format(start_time,'%Y-%m-%d') rows between 6 preceding and current row) as max_retweet_cnt_7d
    from tb_user_video_log log
    left join tb_video_info info
    using(video_id)
    where date_format(log.start_time,'%Y-%m-%d')<'2021-10-04'
    group by info.tag,date_format(start_time,'%Y-%m-%d')
    order by tag desc,dt
) t
where dt between '2021-10-01' and '2021-10-03'

全部评论

相关推荐

10-25 12:05
已编辑
湖南科技大学 Java
若梦难了:我有你这简历,已经大厂乱杀了
点赞 评论 收藏
分享
耀孝女:就是你排序挂了
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务