Dennis,

I understand what you are saying. My problem is specific to only the
sorting. Given the tree:

P1 
    C1 
       GC1 
    C2 
       GC2 
       GC3 
    C3 
P2 
    C4 
    C5 
       GC4 
    C6 
P3 

This structure is perfect for my use. In fact, this is the way I want it.
The children at any level should immediately follow their parent in the
table.

Now suppose, each of these items had a field "Size" and I want to sort this
table such that the structure remains same but the siblings are sorted by
size. For example, the result of a sort might be:

P1 
    C2 
       GC3 
       GC2 
    C3 
    C1 
       GC1 
...

Here, the position of the siblings changed according to sort but the
structure didn't break. I want to know the SQL for achieving this sort using
the path and the size. For example, if I were to use the path as you
described and do an ORDER BY path, size, it will do this but the structure
of the table will break. Because the paths of the siblings would be same and
hence they will become clubbed together and won't be separated by their
children as in the actual structure.

If it is still unclear, I will make and post a real sample.

Thanks,
Sanjay

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

Reply via email to