LedgerIDName Type ParentID
-----------------------------------------------------------
1001AA
CLASS1
1002BB
A/C1001
1003CC
A/C1001
1004EE
CLASS1008
1005DD
A/C1004
1006FF
A/C1004
1007GG
A/C1001
1008HH
CLASS1001
1009II
A/C1008
1010JJ
A/C1009
First sorting Type=CLASS then add child ID
When i pass LedgerID = 1001 then I Want like Below
LedgerIDName TypeParentID
----------------------------------------------------------------
1001AA
CLASS1
1002BBA/C1001
1003CCA/C1001
1007GGA/C1001
1008HH
CLASS1001
1009IIA/C1008
1010JJA/C1008
1004EE
CLASS1008
1005DDA/C1004
1006FFA/C1004