如何在Access中的一个图中绘制来自2个不同表的数据?

时间:2015-06-26 13:38:23

标签: ms-access ms-access-2010

我在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];

1 个答案:

答案 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)