select a.room_id, room_name, count(*) 'user_count' from( select distinct room_id,user_id from user_view_tb u where out_time >= "23:00:00" and out_time <= "24:00:00" )a join room_info_tb r on a.room_id = r.room_id group by a.room_id,room_name order by user_count desc;
需要注意用户会多次进入直播间,所以需要使用select distinct room_id,user_id,from user_view_tb u where out_time >= "23:00:00" and out_time <= "24:00:00"