Monday, 26 August 2013

how can get all child of given id in sql server quey

how can get all child of given id in sql server quey

i have two tables in sql server database:
category( itemid, parentid)
ArticleAssignedCategories(categid, artid)
categid is foregin key of itemid
i want to get count of artids and child of that for given itemid ( child
means catgoreis whith parentid of given itemid.)
for example if given itemid was 1 and in table category have (3,1),(4,1)(5,3)
all of 3, 4, 5 are child of 1
can anyone help me to write a good query?

No comments:

Post a Comment