创建一个提供运行总计但分组的查询? [英] Create a Query that provides a running total but grouped?
问题描述
我需要创建一个查询,为我表中的每个组生成运行总计,例如我希望看到: -
A组
[总计运行] 1
[运行总计] 5
[运行总计] 9
[运行总计] 15 >
B组
[总计] 1
[总计] 2
[运行总计] 20
等..
我已经研究出如何产生一个总计但是这将产生它的所有记录表并且不拆分它(或在找到新组时重置它)。此方法也适用于由于需要分组而失败的唯一ID。
I need to create a query that produces running totals for every group within my table for example i wish to see: -
Group A
[running total] 1
[running total] 5
[running total] 9
[running total] 15
Group B
[running total] 1
[running total] 2
[running total] 20
etc..
I have worked out how to produce a running total but this will produce it for all records in the table and not split it (or reset it when it find a new group). Also this method works on the Unique ID which will fail due to the grouping required.
推荐答案
尝试做一个由你想要的小组做总和的查询,用你的非聚合查询做联盟查询
:)
Hi,
Try to do a query that do the sum by your wanted groups and make Union query with your not aggregate query
:)
谢谢你,我我想我明白你的意思了!!
但是如果我按小组求和然后对结果进行查询,那不就是给我这些小组的总计吗?
我希望按组列出所有记录,每组中的所有字段显示一个运行总计。在我达到目标后,我只想看到ech组中达到一定值的记录。
再次感谢
Thanks for that, I think I understand what you mean!!
But if I sum by group and then run a query on the results, won''t that just give me the running total of the groups?
I am looking to list all records by group with all the fields in each group showing a running total. After I have achieved that I only want to see records in ech group that reach a certain value.
Thanks again
你提到你已经完成了总计!你是怎么做到的?
也许我们可以整合这个?
:)
You mention that u''ve done the running total! How did you do it?
Maybe we can integrate sth with this?
:)
这篇关于创建一个提供运行总计但分组的查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!