三张表查询
SELECT w.company, COUNT(DISTINCT d.RFID_ID) AS total_unique_checkins -- 对每个公司,计算不同RFID_ID的打卡次数 FROM t_worker w JOIN t_rfid r ON w.signNum = r.num1 JOIN t_data d ON r.RFID_ID = d.RFID_ID GROUP BY w.company ORDER BY w.company;
##
QQ 3087438119