select a.persid,b.username,a.cqdate,a.first_punch,a.last_punch from users b left join ( SELECT persid,cqdate,MIN(CONCAT(cqdate, ' ', cqtime)) AS first_punch, MAX(CONCAT(cqdate, ' ', cqtime)) AS last_punch FROM cq_record WHERE year(cqdate)=year('${date}') AND month(cqdate)=month('${date}') GROUP BY persid, cqdate ) a on b.StaffCode=a.persid '${date}'应该怎么用 |