在我的查询设计器中,我尝试使用以下查询:
SELECT Site, LegalConfigNumber, COUNT(*) AS Total
FROM EPSInfoLive
iif(@LegalConfigNum = 0,
WHERE (InputDate >= @rundate) AND (InputDate <= DATEADD(day, 1, @rundate)),
WHERE (InputDate >= @rundate) AND (InputDate <= DATEADD(day, 1, @rundate)) AND LegalConfigNumber = @LegalConfigNum)
GROUP BY LegalConfigNumber, Site
ORDER BY Site, LegalConfigNumber
当我尝试对其进行测试时,我收到一条关于 @LegalConfigNum 语法错误的消息。我似乎无法找到那会在哪里。