以下查询返回 AcquisitionDate 在 RequestDate 的 60 天内的请求计数,以及其他各种列。
如何修改代码以计算RequestDate 后 60 天内唯一AcquisitionDates 的数量?我尝试使用 COUNT DISTINCT 但无法弄清楚在这种情况下应该如何使用它。
SELECT SceneTable.PATH, SceneTable.ROW, SceneTable.ROW, SceneTable.UlLat,
SceneTable.UlLon, SceneTable.UrLat, SceneTable.UrLon, SceneTable.LlLat,
SceneTable.LlLon, SceneTable.LrLat, SceneTable.LrLon,
Sum(Iif((DateDiff("d",[AcquisitionDate],[RequestDate])<60),1,0)) AS Expr1,
Count(RequestTable.RequestID) AS CountOfRequestID
FROM ((SceneTable INNER JOIN
SceneAcquisitionTable
ON SceneTable.SceneID = SceneAcquisitionTable.SceneID) INNER JOIN
UserSceneAcquisitionTable
ON SceneAcquisitionTable.SceneAcquisitionID =
UserSceneAcquisitionTable.SceneAcquisitionID) INNER JOIN
RequestTable
ON UserSceneAcquisitionTable.UserSceneAcquisitionID =
RequestTable.UserSceneAcquisitionID
GROUP BY SceneTable.PATH, SceneTable.ROW, SceneTable.UlLat, SceneTable.UlLon,
SceneTable.UrLat, SceneTable.UrLon, SceneTable.LlLat, SceneTable.LlLon,
SceneTable.LrLat, SceneTable.LrLon
以下是示例表以及预期结果: