Created
November 1, 2017 09:47
-
-
Save tompazourek/dee81d950b1a56d0493016475c3cc821 to your computer and use it in GitHub Desktop.
Load items with all of their parent items as well.
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
WITH [NodesWithParents] AS | |
( | |
SELECT * FROM [Nodes] n WHERE n.[Id] IN (...) | |
UNION ALL | |
SELECT parent.* FROM [Nodes] parent | |
INNER JOIN [NodesWithParents] child ON child.[ParentNode_Id] = parent.[Id] | |
) | |
SELECT DISTINCT [Id] FROM [NodesWithParents] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment