By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,924 Members | 573 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,924 IT Pros & Developers. It's quick & easy.

hierarchical results in sql server 2000

P: 1
Hi all,
i have a problem with nested results. i have to show the main categories and the total number of sub categories next to it. This number should include children for the children also. Say for example if i have a main category called music, and it has rock as a sub which may have soft rock and hard rock as its subs, then i have to show Music as Music(3) like in yahoo groups. i need a sql query to return me the values in this format. I am using SQL server 2000 so CTE is not possible. The table format is Category ID int ,CategoryName nvarchar and ParentCategoryID int.

So any category that is added has a parentCategoryID which will be a previously existing category. So the ParentCategoryID contains a value of a previously existing CategoryID. also i could be having any number of main categories ie. its dynamic.

Could you please help me formulate a query for this?
Sep 8 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.