select a.persid,b.username,a.cqdate,a.first_punch,a.last_punchfrom users bleft 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}'应该怎么用