Created
January 16, 2013 23:34
-
-
Save CloCkWeRX/4552043 to your computer and use it in GitHub Desktop.
Have a data set with a 'parent' and 'child' column, storing paths through a tree (see http://fungus.teststation.com/~jon/treehandling/TreeHandling.htm for the modelling). At the moment, there's a stored proc that takes exactly one ID and builds a data set like the below. Trying to neatly re-write this as a view, so that I can simply add in the "…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
* | |
FROM data | |
WHERE id IN( | |
SELECT @id | |
UNION | |
SELECT child_id FROM paths WHERE parent_id = @id | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment