|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
I have a table with a recursive parent-child relation: Parent_ID refers to Line_ID
example of how that may look: Line_ID . Parent_ID ------------------ 1 . . . . . null -- higest item (no parent) 2 . . . . . 1 3 . . . . . 1 4 . . . . . 2 5 . . . . . 3 6 . . . . . 3 7 . . . . . 5 8 . . . . . 5 9 . . . . . 8 10 . . . . null What i need is the following fucntion/view/..: INPUT = any Line_ID OUTPUT = table with ALL its LOWEST children (a Line_ID that has no Parent_ID refering to it) example: . . 1 . . . . . . . 10 |----| 2 . . 3 | . |---| 4 . 5 . .6 . .|-| . .7 8 . . . | . . . 9 1 would give 4, 6, 7, 9 2 would give 4 3 would give 6, 7, 9 4 would give null 5 would give 7, 9 Last edited by Kris_Vanherck : March 31st, 2004 at 02:56 AM. Reason: formating |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > SQL Recursie view or stored procedure |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|