select FROM_UNIXTIME(sc.time/1000,'%Y-%m-%d %H') as time, count(*) as inCount from t_site s, t_site_clock_in sc where s.id = sc.site_id and s.site_name = #{siteName} and sc.time >= #{startTime} and sc.time <= #{endTime} group by FROM_UNIXTIME(sc.time/1000,'%Y-%m-%d %H') select FROM_UNIXTIME(sc.out_time/1000,'%Y-%m-%d %H') as time, count(*) as outCount from t_site s, t_site_clock_in sc where s.id = sc.site_id and s.site_name = #{siteName} and sc.out_time >= #{startTime} and sc.out_time <= #{endTime} group by FROM_UNIXTIME(sc.out_time/1000,'%Y-%m-%d %H')