I have a table containing (essentially) three columns - id, name, ref_id.
I would like to create an indented list where the columns with ref_id would be indented below the column with the corresponding id, for example:
Name | ID | Ref ID
about 1 0
story 2 1
history 3 1
contact 4 0
help 5 0
map 6 4
directions 7 4
Would ideally create something like this:
about
- story
- history
contact
- map
- directions
help
What would be ideal is one MySQL query that would return the full list as above, if not something that would create it with the least amount of SQL calls and cpu usage. The only way I can think of doing it is incredibly wasteful and I am sure there is a better way.
Thanks in advance!