on 02-29-2008 9:54 AM
In our newest development in NWDS, we want to implement a function to list all parent nodes as a path.
The data schema(pathinfo) is like this:
ID Name Parent
=========================================
1 A null
2 B 1
3 C 2
4 D 2
By following the Parent attribute and ID, we can get the path information for the current node.
E.g. for D, the parent is B(2), and the parent of B is A(1)
Therefore, the parent path of D is B_A
My question is, how to use SQL to list the parent path information for a specific node ID?
Do it naively, I need to execute the query "SELECT Parent FROM pathinfo where ID = X " recursively, each time get only one parent node. Is that the only way to solve this problem? If so, can we modify the data schema so that it can retrieves the parent path more efficiently?
Edited by: Zenghuan Shan on Feb 29, 2008 10:57 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.