hi to all
I have a table as shown below. ID1 is an autonumber field. ID2 increases by 1 after each 6 records. For each ID1,ID2 combination, there are 7 values of Val listed in increasing order. The 7 values of Val are taken from the integers 1 to 12 with no repeats.
I need output that shows, for each ID1,ID2 combination, the MAXIMUM number of CONSECUTIVE values of Val. For the example above, the output should be...
Thanks in advance for any help.
Teach314
I have a table as shown below. ID1 is an autonumber field. ID2 increases by 1 after each 6 records. For each ID1,ID2 combination, there are 7 values of Val listed in increasing order. The 7 values of Val are taken from the integers 1 to 12 with no repeats.
Code:
ID1 ID2 Val
================
1 104 2
2 104 3
3 104 7
4 104 8
5 104 9
6 104 10
7 105 1
8 105 2
9 105 5
10 105 7
11 105 9
12 105 10
13 106 1
14 106 3
15 106 5
16 106 7
17 106 9
18 106 12
etc...
I need output that shows, for each ID1,ID2 combination, the MAXIMUM number of CONSECUTIVE values of Val. For the example above, the output should be...
Code:
ID2 MaxConsecCount
========================
104 4 (from the 7, 8, 9, 10)
105 2 (from either the 1, 2 or the 9, 10)
106 0
Thanks in advance for any help.
Teach314