I have a reasonably large set of phone numbers (approximately 2 million) in a database table. These numbers have been inserted in blocks, so there are many continuous ranges
Theoretically the items in a set have no particular value, so I'm assuming you also have some continuous ID column that defines the order of the numbers. Something like this:
ID Number
1 1000
2 1001
3 1002
4 1010
5 1011
6 1012
7 1013
8 1020
9 1021
10 1022
You could create an extra column that contains the result of Number - ID
:
ID Number Diff
1 1000 999
2 1001 999
3 1002 999
4 1010 1006
5 1011 1006
6 1012 1006
7 1013 1006
8 1020 1012
9 1021 1012
10 1022 1012
Numbers in the same range will have the same result in the Diff column.