Microsoft Access 分组按照

huangapple go评论49阅读模式
英文:

Microsoft Access Group by

问题

有没有办法将我的姓名分组并按姓名汇总金额?请参考表格。姓名列来自多个表格。总共有约20个,但它们的值可能在任何列中重复。正如可以看到的,例如Michaela。我还有一个日期筛选器。如果我只查询一个列,那么姓名将被分组在一起并且金额将被累加,但我希望有所有列的一组。

提前感谢任何建议。

一个列可以正常工作。

英文:

is there a way to group my names together and add up the amount of money by name? See Table. Name columns... are from multiple tables. I have about 20 in total, but their value can be repeated in any column. As can be seen, for example, with Michaela. I also have a date filter there. If I make a query on only one column, the names are grouped together and the amounts are added up, but I would like to have a set of all columns.

Thanks in advance for any advice.

enter image description here

One column works fine
enter image description here

答案1

得分: 0

使用联合查询来收集数据:

选择 NameField1 作为 FullNameSumField1 作为 Amount  Table1
联合全部
选择 NameField2, SumField2  Table1
联合全部
选择 NameField1, SumField1  Table2

--- 等等。

现在,将这个查询作为源查询:

选择 FullName, Sum(Amount) 作为 TotalAmount
 YourUnionQuery
 FullName 分组
英文:

Use a union query to collect the data:

Select NameField1 As FullName, SumField1 As Amount From Table1
Union All
Select NameField2, SumField2 From Table1
Union All
Select NameField1, SumField1 From Table2

--- etc.

Now, use this query as source in yet a query:

Select FullName, Sum(Amount) As TotalAmount
From YourUnionQuery
Group By FullName

huangapple
  • 本文由 发表于 2023年7月17日 19:23:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/76703957.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定