如何在两个表中使用count()

时间:2013-12-04 21:40:48

标签: sql ms-access

我试图在两个单独的表中进行计数。当我单独运行查询时,计数很好。当我尝试将它们组合时,计数是不正确的。这是每个单独查询的SQL。

SELECT [Leads Received].[Date Received], Employees.LastName, Employees.FirstName
     , Count([Leads Received].[Date Received]) AS [CountOfDate Received]
  FROM Employees 
 INNER JOIN [Leads Received] 
    ON Employees.AgentID = [Leads Received].AgentID
 GROUP BY [Leads Received].[Date Received], Employees.LastName, Employees.FirstName;


SELECT [Leads Proposed].ACCTGDATE, Employees.LastName, Employees.FirstName
     , Count([Leads Proposed].AgentID) AS CountOfAgentID
  FROM Employees 
 INNER JOIN [Leads Proposed] 
    ON Employees.AgentID = [Leads Proposed].AgentID
 GROUP BY [Leads Proposed].ACCTGDATE, Employees.LastName, Employees.FirstName;

任何人都可以帮我加入这些,以便他们显示每个的正确计数吗?

0 个答案:

没有答案