我在Access中有2个表,使用2个不同的查询创建。 我想在1个图中放入2个表数据,而不是在2个单独的图中。 该表由以下两个单独的查询提取:
SELECT count(*) AS [Count], History.[activationDate]
FROM History
WHERE History.activationDate is not null
GROUP BY History.[activationDate];
SELECT count(*) AS [Count], History.[deactivationDate]
FROM History
WHERE History.deactivationDate is not null and deactivationDate < lastSeenDate
GROUP BY History.[deactivationDate];
答案 0 :(得分:0)
然后可能是:
SELECT
Sum(Abs(History.activationDate is not null)) AS [ActiveCount],
Sum(Abs(History.deactivationDate is not null)) AS [DeactiveCount],
[SearchDateX] As SearchDate
FROM
History
WHERE
(History.deactivationDate + History.deactivationDate Is Not Null)
And
(History.deactivationDate = [SearchDateX]
OR
History.deactivationDate = [SearchDateX])
或者所有日子:
SELECT
History.activationDate,
History.deactivationDate,
Sum(Abs(History.activationDate is not null)) AS [ActiveCount],
Sum(Abs(History.deactivationDate is not null)) AS [DeactiveCount],
FROM
History
GROUP BY
History.activationDate,
History.deactivationDate
HAVING
(History.activationDate Is Not Null)
OR
(History.deactivationDate Is Not Null
And
History.deactivationDate < lastSeenDate)