以下查询返回RequestDate在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
以下是样本表以及预期结果: