I have a table with the following schema:
ID , CatID, ParentCatID, SiteID
I want to get all sites belonging to categories that are roots (means their ParentCatID = 0) and all their descendants.
eg:
ID , CatID, ParentCatID, SiteID -------------------------------- 1 , 2 , 0 , 3 1 , 4 , 2 , 6 1 , 5 , 4 , 7
In this example, CatID 2 is parent 4 and 4 is parent 5.
How can I get all site identifiers that belong to the root category and all its descendants.
sql sql-server tsql
Joseph ghassan
source share