This path is a nice idea to keep it simple for what I want to do. But I have
a question:

Suppose the database is like this:

id, parentid, data
1, 0, parent 
2, 1, son B
3, 1, son A
4, 1, daughter A
5, 1, daughter B
6, 2, grandchild B
7, 2, grandchild A

Using the path approach, how can I sort this tree such that the structure
remains same (children immediately after parent) but the children are sorted
in their own level. So the result should be:

id, parentid, data
1, 0, parent 
4, 1, daughter A
5, 1, daughter B
3, 1, son A
2, 1, son B
7, 2, grandchild A
6, 2, grandchild B

If I sort using the path then the structure is disturbed because the top
level children are then clubbed together (same path) and their own children
are separated by several rows downwards.

The reason I want to preserve the structure is that I am filling a tree
control and preserving the structure makes it simpler to code in a recursive
manner.

Thanks,
Sanjay
--
View this message in context: 
http://www.nabble.com/Managing-trees-in-the-database-t1135555.html#a2983922
Sent from the SQLite forum at Nabble.com.

Reply via email to