I have non-consecutive, but ordered numeric identifiers. I would like to get consecutive values.
Current Table:
original_value
1
1
1
3
3
29
29
29
29
1203
1203
5230304
5230304
5230304
5230304
Desired Table:
original_value desired_value
1 1
1 1
1 1
3 2
3 2
29 3
29 3
29 3
29 3
1203 4
1203 4
5230304 5
5230304 5
5230304 5
5230304 5
Another approach, sans joining:
Live test: http://www.sqlfiddle.com/#!2/b82d6/6
If you want to remove calculations in result, table-derive the query:
Live test: http://www.sqlfiddle.com/#!2/b82d6/4