I know some of you are dead-set against cursors, so please see if you can help me with this one. (It is not homework.)
I have a very large table (730,000 rows). I need to determine if an integer in one field of the composite key in that table is consecutive for 10 rows, 100 rows, or 1000 rows. If it is consecutive for that many rows, I need to pick the topmost row value and display it in one row along with the denomination.
The values in this one column are always 5 digits long.
Example input:
Example output:
Please note that 30040 will not be in the output, because it is not consecutive from 30040-30049 inclusive.
Other outputs might say:
or
Thanks for your help,
--Shaun
I have a very large table (730,000 rows). I need to determine if an integer in one field of the composite key in that table is consecutive for 10 rows, 100 rows, or 1000 rows. If it is consecutive for that many rows, I need to pick the topmost row value and display it in one row along with the denomination.
The values in this one column are always 5 digits long.
Example input:
Code:
30022
30030
30031
30032
30033
30034
30035
30036
30037
30038
30039
30040
30043
30049
30074
Example output:
Code:
30030, 10
Other outputs might say:
Code:
34300, 100
Code:
30030, 10
34300, 100
42000, 1000
Thanks for your help,
--Shaun