且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用出勤率创建月度报告

更新时间:2023-02-05 15:47:29

如果不查看出勤"表就无法为您提供确切的SQL查询.

在雇员"表和出勤"表之间使用左外部联接.

SQL左联接

使用外部联接
It would not be possible to provide you exact SQL Query without looking at your "Attedance" Table.

Use Left Outer join between your "Employee" table and "Attedance" Table.

SQL LEFT JOIN

Using Outer Joins


创建第三个临时表,每个月中的每一天都有一行.
在此临时表和出勤"表之间执行LEFT OUTER JOIN.
与employee表一起加入,您应该列出employee表的全天列表.

然后,您可以删除临时表.
Create a third temporary table with a row for every day in a month.
Do a LEFT OUTER JOIN between with this temporary table and the Attendance table.
Join this with the employee table and you should a list of all days with employee table.

You can then drop the temporary table.