select a.course_id,course_name,a.ct from course_tb join (select course_id,count(distinct user_id) ct from attend_tb where mid(in_datetime,12,5)<='19:00' group by course_id ) a on course_tb.course_id=a.course_id order by a.course_id;
select a.course_id,course_name,a.ct from course_tb join (select course_id,count(distinct user_id) ct from attend_tb where mid(in_datetime,12,5)<='19:00' group by course_id ) a on course_tb.course_id=a.course_id order by a.course_id;