Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Has Children Query

Author  Topic 

tml
Starting Member

2 Posts

Posted - 2008-12-10 : 17:47:43
I have a table I'm using for site navigation. I can query the top level pages by checking to see if the navigation record has a ParentNavigationID. What I want to accomplish is getting the number of child pages each top level navigation has in the same query.

Can someone provide a sample?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-10 : 17:51:50
You can use a recursive CTE.
See http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=115290



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -