Max 和 Group By 可能适合:
SELECT Docs.Person, Docs.Doc, Max(Docs.DateEntered) AS MaxOfDateEntered
FROM Docs
GROUP BY Docs.Person, Docs.Doc;
其中 Docs 是您的表或查询的名称。
输入:
Person Doc DateEntered
Smith,John AAA 11-5-2012
Smith,John AAA
Doe,Jane AAA
Doe,Jane AAA
结果:
Person Doc MaxOfDateEntered
Doe,Jane AAA
Smith,John AAA 11-5-2012
编辑重新评论
SELECT doc.Name, doc.Site, doc.Document, Max(doc.Expr1003) AS MaxOfExpr1003
FROM doc
GROUP BY doc.Name, doc.Site, doc.Document;
编辑重新评论#2
SELECT
ResultsTbl.Name,
ResultsTbl.Site,
ResultsTbl.Document,
Max(ResultsTbl.Expiration_Date) AS Expiration_Date
FROM (
SELECT
lname & ', ' & fname AS Name,
site_name AS Site,
Document, cv_request_expires_on AS Expiration_Date
FROM Coord_CV_Expiration
UNION SELECT
lname & ', ' & fname AS Name,
site_name AS Site,
Document,
cv_request_expires_on AS Expiration_Date
FROM LeadCoord_CV_Expiration ...) AS ResultsTbl
GROUP BY ResultsTbl.Site, ResultsTbl.Document, ResultsTbl.Name
ORDER BY ResultsTbl.Expiration_Date;
请注意,您不应按到期日期分组。