以下查询未在我的ms Access 2010数据库中返回CurrentVisitor
的值:
SELECT h.ClientNumber, IIf(h.CheckoutDate=null,"Yes","") AS CurrentVisitor
FROM VisitsTable AS h
INNER JOIN (
SELECT ClientNumber, MAX(LastVisitDate) AS LastVisitStart
FROM VisitsTable
GROUP BY ClientNumber)
AS t
ON (h.LastVisitStart = t.LastVisitStart) AND (h.ClientNumber = t.ClientNumber);
我认为原因是
If()
操作中对null的检查未正确编写。谁能告诉我如何解决这个问题? 最佳答案
用
Is Null
而不是
= Null
关于sql - 检查MS Access SQL语句中的空值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19390655/