I have a data table in which its one column refers another column in the same table. I want to select all such referring records together where the referring one shows immediately after the parent record no matter where the both records are saved in the table.
Example: Table:
ID | Name | Spouse
1 | abc | 4
2 | def | 6
3 | ghi |
4 | jkl |
5 | mno | 3
6 | pqr |
7 | stu |
Select and sort the above data set in the following order
ID | Name | Spouse
1 | abc | 4
4 | jkl |
2 | def | 6
6 | pqr |
3 | ghi |
5 | mno | 3
7 | stu |
