``` select live_id, max(user_count) max_user_count from ( select user_id, live_id, sum(user_change) over(partition by live_id order by event_time) user_count from ( select user_id, live_id, in_datetime event_time, 1 user_change from live_events union all select user_id, live_id, out_datetime, -1 from live_events )t1 )t2 group by live_id; 同时最大人数问题,打标签+1,-1然后union聚合,结束
16 1

相关推荐

点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务