我创建了一个用于渲染超时的模块。在该模块中,您将选择您的批准人,最多 3 人。
场景是,如果不NULL
manager1_date
,manager2_date
不NULL
并且manager3_date
不NULL
,我将显示所有批准的加班。但正如我所说,它只能是 1、2 或 3 个批准人。如果我申请,那么我只有 2 个批准人怎么办,应该是如果manager1_date
没有NULL
并且manager2_date
不是NULL
.
我尝试了这个查询:
Select * from table1
where manager1_date is not null
AND (manager2_date is not null or manager3_date is not null)
在 PHP 中,它显示记录,但记录具有第 3 个审批人,manager3_date
NULL
.在填写审批人之前,它不应显示记录。
我想你是说三位经理都必须批准。 如果是这样,您的查询将是:
SELECT *
FROM table1
WHERE manager1_date IS NOT null
AND manager2_date IS NOT null
AND manager3_date IS NOT null
我不确定我是否理解你的问题,但如果您需要查看所有三个经理日期何时都不为空,请去掉"或"。
Select *
from table1
where manager1_date is not null
AND manager2_date is not null
AND manager3_date is not null