0

我试图在 access 2010 中加入两个查询。

两个查询都有名称和月份。一个已分配 # 个任务,另一个已关闭 # 个。我想加入他们,这样我就可以看到每个月每个人分配和关闭的数量。分配了 # 的查询有更多行。我尝试使用名称左连接,因为左侧的查询已分配并且有更多列。但我不能让它工作,因为行号不同,我也不能把月份号联系起来。我怎样才能将它们结合在一起?先感谢您。

查询类似于:

1.
Name   Month   # assigned 
John.      1.          7
Lee.       1.          8



2.
Name.  Month.  # closed. 
John.      1.          5 

想:

Name. Month  # assigned.  # closed 
4

1 回答 1

0

As you haven't given names of tables or columns you are going to have to substitute those in.

The below query will return all rows from Table1 and the matching Closed from Table2.

SELECT Table1.Name, Table1.Month, Table1.Assigned, Table2.Closed
FROM Table1 LEFT JOIN Table2 ON Table2.Name = Table1.Name AND Table2.Month = Table1.Month;
于 2013-08-29T04:35:38.227 回答