|
Posted by Ben on 11/01/05 02:55
Hi Erland,
Thanks a lot for your reply.
First off, thanks for reminding me about the "sp_," it's a very bad
habit my company has gotten me into, and I am trying to break out of
it.
I applied your algorithm to some test data and it yielded the record
set in a breadth first manner, which could be very useful, however I
would like to render the folders in a depth first manner.
For example, if I had the simple tree:
A:-->B,C; B:-->D; C-->E;
+------------------------+
|folderid| parent| name |
+------------------------+
|1 | Null | A |
|2 | 1 | B |
|3 | 1 | C |
|4 | 2 | D |
|5 | 3 | E |
+------------------------+
Then I would want to display it in the following order:
A,B,D,C,E.
That would visually be:
A
B
D
C
E
Rather than:
A
B
C
D
E
I have tried to construct some way to join the two tables (#tmp and
Folders) together to achieve this result, but I have been unable to
come up with anything so far, besides my original post.
Please let me know of any ideas you have.
[Back to original message]
|