题解 | 输出播放量最高的视频

输出播放量最高的视频

https://www.nowcoder.com/practice/9e9cb264e1f64e28846975d5a32ba8e4

select cid,max(max_peak_uv) as max_peak_uv
from 
(select
    t1.cid,

        sum(t1.tag) over (
            partition by
                cid
            order by
                dt asc,
                tag desc
        )
     as max_peak_uv
from
    (
        select
            cid,
            start_time as dt,
            1 as tag
        from
            play_record_tb
        union all
        select
            cid,
            end_time as dt,
            -1 as tag
        from
            play_record_tb
    ) as t1) as t2
    group by cid
    order by max_peak_uv desc
    limit 3;


全部评论

相关推荐

点赞 评论 收藏
分享
Yki_:你要算时间成本呀,研究生两三年,博士三四年,加起来就五六年了,如果你本科去腾讯干五年,多领五年的年薪,加上公司内涨薪,可能到时候十五年总薪资也跟博士差不多
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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