以下查询未在我的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检查未正确写入。谁能告诉我如何解决这个问题?
答案 0 :(得分:19)
使用
Is Null
而不是
= Null