I have a hierarchy table which looks like this:
id child_id
1 2
2 3
2 4
3 5
3 6
3 7
4 8
4 9
4 10
How to write a query to get results in such format:
1
|_ 2
|_ 3
| |_ 5
| |_ 6
| |_ 7
|_ 4
|_ 8
|_ 9
|_ 10