Given a table like this:
taskId | nextTaskId |
---|---|
1 | 2 |
2 | 3 |
3 | 6 |
4 | 5 |
5 | NULL |
6 | 7 |
7 | 8 |
8 | 4 |
I need the following order for output:
taskId | nextTaskId |
---|---|
1 | 2 |
2 | 3 |
3 | 6 |
6 | 7 |
7 | 8 |
8 | 4 |
4 | 5 |
5 | NULL |
Is there any way to do this via MySQL query?