问题描述
我需要帮助来在Access中创建一个查询,以递增数量的行组(在一个公共日期进行分组),并使组号"在下一个日期保持递增,如结果"列中所示.
I need help to create a query in Access to incrementally number groups of rows, grouped on a common date and keep the "group numbers" increment on the next date like showing in the Result column.
2017/01/09 | 809 | 1
2017/01/09 |809 | 1
2017/01/09 | 810 | 1
2017/01/09 |810 | 1
2017/01/09 | 826 | 1
2017/01/09 |826 | 1
2017/01/10 | 826 | 2
2017/01/10 |826 | 2
2017/01/11 | 809 | 3
2017/01/11 |809 | 3
2017/01/11 | 810 | 3
2017/01/11 |810 | 3
2013/01/11 | 826 | 3
2013/01/11 |826 | 3
2017/01/12 | 809 | 4
2017/01/12 |809 | 4
2017/01/12 | 810 | 4
2017/01/12 |810 | 4
2017/01/12 | 826 | 4
2017/01/12 |826 | 4
谢谢
推荐答案
这是一种方法:SELECT A.*, (SELECT Count(*) FROM (SELECT DISTINCT [Date] FROM Table1) AS Q1 WHERE A.Date>=[Date]) AS GrpSeq FROM Table1 AS A;
Here is one approach:SELECT A.*, (SELECT Count(*) FROM (SELECT DISTINCT [Date] FROM Table1) AS Q1 WHERE A.Date>=[Date]) AS GrpSeq FROM Table1 AS A;
另一个是报表上组头"中文本框的属性:
RunningSum:OverGroup
ControlSource:= 1
Another is with properties of textbox in Group Header on report:
RunningSum: OverGroup
ControlSource: =1
这篇关于在MS Access中返回每个组的增量组号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!