根据这三个表查询一下字段名称 数据类型 说明 示例数据emp_id int类型索引ID可用于主键。 员工ID 1emp_sex char类型长度40 员工性别 男emp_email varchar类型长度50 员工邮箱 liubeishuguocomemp_salary varchar类型长度10 薪水 30000emp_bonus varchar类型长度10 奖金 10000emp_job_id
SELECT c.calendar_date, e.emp_name, a.clock_in, a.clock_out FROM calendar c CROSS JOIN employee e LEFT JOIN attendance a ON c.calendar_date = DATE(a.check_date) AND e.emp_id = a.emp_id WHERE a.clock_in IS NULL OR a.clock_out IS NULL AND c.is_work_day = 'Y' ORDER BY c.calendar_date, e.emp_id CREATE VIEW table5 AS SELECT c.calendar_date, e.emp_name, a.clock_in, a.clock_out FROM calendar c CROSS JOIN employee e LEFT JOIN attendance a ON c.calendar_date = DATE(a.check_date) AND e.emp_id = a.emp_id WHERE a.clock_in IS NULL OR a.clock_out IS NULL AND c.is_work_day = 'Y' ORDER BY c.calendar_date, e.emp_i
原文地址: https://www.cveoy.top/t/topic/ghfN 著作权归作者所有。请勿转载和采集!