I want to use SQL to re-arrange the records in a table. In the first table below, the records are arranged in numerical step order. We want them re-arranged in next step order.
If we start with the first table below, the query should generate the second table below. It does not matter if we need to add other columns to the output/query table, such as a first column that creates a new numerical order such as row numbers. A sequence of queries is also O.K.
Step# NextStep#
1 10
5 7
7 1004
10 52
52 5
1004
The re-arranged table should be
sequence
1
10
52
5
7
1004
Thanks in advance.
If we start with the first table below, the query should generate the second table below. It does not matter if we need to add other columns to the output/query table, such as a first column that creates a new numerical order such as row numbers. A sequence of queries is also O.K.
Step# NextStep#
1 10
5 7
7 1004
10 52
52 5
1004
The re-arranged table should be
sequence
1
10
52
5
7
1004
Thanks in advance.