三张表查询

 

 

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;

 

 

 

##

posted @ 2024-08-08 20:49  西北逍遥  阅读(5)  评论(0编辑  收藏  举报