Hi to All...
I have the following Table(Not fixed length)
Table A:
Time Class
-------------
10,12 A
11,2 A
12 B
13 B
14,3 B
15 A
16 C
etc...
And want to produce a more synoptic table with the same info B...
Table B:
LowBound UpperBound Class
---------------------------------
10,12 12 A
12 15 B
15 16 A
16 16 C
etc...
I've tried to find an SQL query , but the prob is that I don't want to group all A's or B's or... together but only if they are continuous(sth like Run Length Encoding)
So I have planned an algorithm to perform the task But I don't know how to write it using recordsets and how can I send the data needed from one table to another...
I'm Sending you the Algorithm So If anyone has any Idea on how it can be transported in VB for Access or any suggestions at all I would be gratefull.
i=1
B[1].LowBound=A[1].Time
j=1
while i<TotalofRecords do
if A.class<>A[i+1].class then
B[j].UpperBound=A[i+1].Time
B[j+1].LowBound=A[i+1].Time
B[j].class=A.class
i=i+1
j=j+1
else
i=i+1
end if
Loop
B[j].UpperBound=A.Time 'To treat last value
B[j].class=A.class 'properly
Thanks In Advance
Nick
P.S.>I Think that any tip on how to index a table and how to move data between the two tables would be of great help..
I have the following Table(Not fixed length)
Table A:
Time Class
-------------
10,12 A
11,2 A
12 B
13 B
14,3 B
15 A
16 C
etc...
And want to produce a more synoptic table with the same info B...
Table B:
LowBound UpperBound Class
---------------------------------
10,12 12 A
12 15 B
15 16 A
16 16 C
etc...
I've tried to find an SQL query , but the prob is that I don't want to group all A's or B's or... together but only if they are continuous(sth like Run Length Encoding)
So I have planned an algorithm to perform the task But I don't know how to write it using recordsets and how can I send the data needed from one table to another...
I'm Sending you the Algorithm So If anyone has any Idea on how it can be transported in VB for Access or any suggestions at all I would be gratefull.
i=1
B[1].LowBound=A[1].Time
j=1
while i<TotalofRecords do
if A.class<>A[i+1].class then
B[j].UpperBound=A[i+1].Time
B[j+1].LowBound=A[i+1].Time
B[j].class=A.class
i=i+1
j=j+1
else
i=i+1
end if
Loop
B[j].UpperBound=A.Time 'To treat last value
B[j].class=A.class 'properly
Thanks In Advance
Nick
P.S.>I Think that any tip on how to index a table and how to move data between the two tables would be of great help..