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

输出播放量最高的视频

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

select cid,round(max(peak_uv),3) as max_peak_uv
from(
select cid,sum(tag)over(partition by cid order by time) as peak_uv
from(
select cid,start_time as time,1 as tag
from play_record_tb
union all
select cid,end_time as time,-1 as tag
from play_record_tb)a)b
group by cid
order by max_peak_uv desc
limit 3

要是只求播放量最高那更简单了,直接聚合count一下

但是描述里感觉这道题还是和求同一时刻的播放量top3那道题一样

全部评论

相关推荐

评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务