March 24, 2014 at 1:40 pm
Hey all,
I feel like I already know the answer to this question, but it is eluding me ...
Say I have a table with two columns - ID and ParentID. Say this table has the following values:
IDParentID
1050
2030
3010
50NULL
Now, say I want the following output from my query:
IDParentIDOrder
10502
20304
30103
50NULL1
Is there any way to get this result in a single query, without needing potentially infinite recursion or using a row-by-row comparaison?
March 24, 2014 at 2:32 pm
Sure... you could do a 4 way self join but that's hardcoding levels.
Recursion isn't so bad here. It will do things by level, not by row.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply