HERE IS DATA IN KOK TABLE
ID Parent_ID Lev Name
1 1 AAA
2 1 2 AAB
3 1 2 AAD
4 1 BBB
5 1 2 AAC
6 5 2 BBC
RESULT I WANT
ID Parent_ID Lev Name
1 1 AAA
2 1 2 AAB
5 1 2 AAC
3 1 2 AAD
4 1 BBB
6 5 2 BBC
ANY BODY CAN HELP USE SINGLE SELECT STATEMENT TO SORT THE TABLE DATA
I TRY USE THE FOLLOWING SELECT STAEMENT, BUT THE RESULT IS NOT CORRECT:
SELECT * FROM KOK CONNECT BY PRIOR ID = PARENT_ID
START WITH LEV = 1
ID Parent_ID Lev Name
1 1 AAA
2 1 2 AAB
3 1 2 AAD
4 1 BBB
5 1 2 AAC
6 5 2 BBC
RESULT I WANT
ID Parent_ID Lev Name
1 1 AAA
2 1 2 AAB
5 1 2 AAC
3 1 2 AAD
4 1 BBB
6 5 2 BBC
ANY BODY CAN HELP USE SINGLE SELECT STATEMENT TO SORT THE TABLE DATA
I TRY USE THE FOLLOWING SELECT STAEMENT, BUT THE RESULT IS NOT CORRECT:
SELECT * FROM KOK CONNECT BY PRIOR ID = PARENT_ID
START WITH LEV = 1