I have a below table and i want the output in the form of a tree such that if we pass the Unique_Id of Admin we will be able to view all the list as all are the child of ADMIN.
Similarly if i pass the unique_id of user1Child1 i will get user1Child1child1 and user1Child1child2 , because user1Child1 is the parent of both of them.
similar case if user1Child1child1 and user1Child1child2 have children's they should also come in the list and so on...
Table:
Name | Sponser_ID | Added_By | Position | Unique_ID |
---|
ADMIN | EFQAAAA123 | ADMIN | NULL | EFQAAAA123 |
user1Child1 | EFQAAAA123 | ADMIN | Left | EFQAAAA456 |
user2Child2 | EFQAAAA123 | ADMIN | Right | EFQAAAA789 |
user1Child1child1 | EFQAAAA456 | ADMIN | Right | EFQAAAD085 |
user1Child1child2 | EFQAAAA456 | ADMIN | Left | EFQAAAE985 |
user2Child2child1 | EFQAAAA789 | ADMIN | left | EFQAAAP210 |
| | | | |