题解 | 短视频直播间晚上11-12点之间各直播间的在线人数
select
room_id,
room_name,
count(*) user_count
from
(
select distinct
user_id,
uvt.room_id,
room_name
from
test.user_view_tb uvt
join test.room_info_tb rit on uvt.room_id = rit.room_id
where
hour (in_time) >= 23
or hour (out_time) >= 23
) a
group by
room_id,
room_name
order by
user_count desc,
room_id asc
腾讯成长空间 5981人发布
