Is it possible to create a \"tree resolver\" in SQL?
I have a table:
ID Name Parent
1 a
2 b 1
3 c 1
4 d 3
Now I want a SQL
There are several different ways to represent a tree in an SQL database. I guess I don't know much, but I do know that Django Treebeard uses 3 different ways to do it. If you look at the documentation, it has short descriptions of each way:
adjacency list -- what you're doing already
materialized path -- article: http://www.dba-oracle.com/t_sql_patterns_trees.htm
nested sets -- oh, here's wikipedia: http://en.wikipedia.org/wiki/Nested_set_model