select course_id, course_name, count(in_datetime) from attend_tb left join course_tb using(course_id) where '190000' between date_format(in_datetime,'%H%i%s') and date_format(out_datetime,'%H%i%s') group by course_id, course_name