下面的查询将返回“购置日期”在“请求日期”后60天内提出的申请数,以及其它各栏。
我怎样才能修改代码来计算请求日后60天内“强势”/“强势”收购的数量? 我试图使用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
Here are sample tables as well as expected results: