题解 | 短视频直播间晚上11-12点之间各直播间的在线人数

短视频直播间晚上11-12点之间各直播间的在线人数

https://www.nowcoder.com/practice/38f5febc9dac4e9e84ed5891a3e4ca05

with t as (select user_id, room_id
from user_view_tb
where (in_time between "23:00:00" and "24:00:00" )
or (out_time between "23:00:00" and "24:00:00" )
),

t2 as (select t.room_id, t.user_id, r.room_name
from t left join room_info_tb r
on t.room_id = r.room_id)

select room_id, room_name, count(distinct user_id) as user_count
from t2 
group by room_id, room_name
order by user_count desc

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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