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.
| Author |
Topic |
|
tehprince
Starting Member
9 Posts |
Posted - 2007-12-18 : 13:11:59
|
| I'm looking to build a menu / sitemap out of my 2005 SQL Server database, an example of my table structure is:ID PageTitle ParentID=======================================1 Home 02 About Us 13 Contact Us 14 About Us / Sub 1 25 About Us / Sub 2 26 About Us / LVL 3 5So essentially this menu should display as follows:Home About Us About Us / Sub 1 About Us / Sub 2 About Us / LVL 3 Contact UsIs it possible to write a query that would output menu in that specific order? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-18 : 13:20:20
|
Yes. Take a look at recursive CTE (Common Table Expression) in Books Online. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|