Mysql 检索日期值为空的行

Mysql 检索日期值为空的行,mysql,null,Mysql,Null,我想检索一段时间内缺席的所有员工的姓名 我需要一个可以返回空考勤的员工的查询。数据结构如下所示: date: 17-07-2012 empname | intime | outtime | teamtype abs | NULL | NULL | PD dfg | NULL | NULL | PD date: 18-07-2012 empname | intime | outtime | teamtype abs | NULL | NUL

我想检索一段时间内缺席的所有员工的姓名

我需要一个可以返回空考勤的员工的查询。数据结构如下所示:

date: 17-07-2012

empname | intime | outtime | teamtype 
abs     | NULL   | NULL    | PD
dfg     | NULL   | NULL    | PD

date: 18-07-2012

empname | intime | outtime | teamtype 
abs     | NULL   | NULL    | PD
ghf     | NULL   | NULL    | PD
dfg     | NULL   | NULL    | PD

我想您需要在指定时间不在场的员工名单。请注意,我猜测了表名和列,因为它们不包括在您的问题中:

select empName
from employees left outer join attendance
    on employees.id = attendance.employee_id and :DATE between intime and outtime
where
    attendance.employee_id is null

请提供更多信息,如表结构、示例数据、以前尝试过的查询。谢谢。您的数据与样本中的日期有什么关系?您是否正在寻找在指定日期未到场的所有员工?(介于“$from”和“$to”之间的InDate是u部分遗漏的范围
select empName
from employees left outer join attendance
    on employees.id = attendance.employee_id and :DATE between intime and outtime
where
    attendance.employee_id is null