请参阅以下 SQL 语句:
SELECT datediff("d", MAX(invoice.date), Now) As Date_Diff
, MAX(invoice.date) AS max_invoice_date
, customer.number AS customer_number
FROM invoice
INNER JOIN customer
ON invoice.customer_number = customer.number
GROUP BY customer.number
如果添加了以下内容:
HAVING datediff("d", MAX(invoice.date), Now) > 365
这会简单地排除 Date_Diff <= 365 的行吗?
这里 HAVING 子句的作用应该是什么?
编辑:我没有体验到这里的答案在说什么。mdb 的副本位于http://hotfile.com/dl/40641614/2353dfc/test.mdb.html(无宏或病毒)。VISDATA.EXE 用于执行查询。
EDIT2:我认为问题可能是 VISDATA,因为我通过 DAO 遇到了不同的结果。