#19;00 在线人数 #per subject #asc course id select ct.course_id, ct.course_name,count(distinct at.user_id) as online_num from attend_tb at join course_tb ct on at.course_id=ct.course_id where time(at.in_datetime)<='19:00:00' and time(at.out_datetime)>='19:00:00' group by ct.course_id, ct.course_name