So, I have a table like such:
id|root|kw1|kw2|kw3|kw4|kw5|name
1| A| B| C| D| E| F|fileA
2| A| B| | | | |fileB
3| B| C| D| E| | |fileC
4| A| B| | | | |fileD
(several hundred rows...)
And I need to get it into a tree like the following:
*A
*B
-fileB
-fileD
*C
*D
*E
*F
-fileA
*B
*C
*D
*E
-fileC
I'm pretty sure the table is laid out poorly but it's what I have to live with.
I've read a little about Adjacency List Model & Modified Preorder Tree Traversal but I don't think my data is laid out correctly. I think this requires a recursive function, but I'm not at all sure how to go about that.
I'm open to any ideas of how to get this done even if it means extracting the data into a new table just to process this.
Are there any good options available to me or any good ways to do this? (Examples are a bonus of course)