![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello all, I'm banging my head against a brick wall again. How would I do the following. If my data is From To 1 2 2 3 3 4 5 NULL 6 7 How would I get a list back that shows the parent child relationships. I'd like a stored proc that given parameter 2 for example, would return: 2 3 4 Any help would be great. Thanks, Jon |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
You can use a CTE for this, but depending on the level of recursion and the needs for extra coding around infinite loops and so forth, a better solutions might be to use either an adjacency model or nested set theory. Both of which are very fast and very flexible. Rick Sawtell |
#5
| |||
| |||
|
|
On 27 Aug, 16:28, "Rick Sawtell" <r_sawt... (AT) nospam (DOT) hotmail.com> wrote: You can use a CTE for this, but depending on the level of recursion and the needs for extra coding around infinite loops and so forth, a better solutions might be to use either an adjacency model or nested set theory. Both of which are very fast and very flexible. Rick Sawtell Rick, have any examples of either? |
#6
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |