I have a table with the following schema :
ID , CatID, ParentCatID, SiteID
I want to get all the sites that belong to the categories that are the roots ( means their ParentCatID = 0) and all their descendants.
for example :
ID , CatID, ParentCatID, SiteID
--------------------------------
1 , 2 , 0 , 3
1 , 4 , 2 , 6
1 , 5 , 4 , 7
In this example CatID 2 is the parent of 4 and 4 is the parent of 5.
How can I get all the SiteIDs that belongs to the root category and all its descendants.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…