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 2000 Forums
 Transact-SQL (2000)
 SQL in Recursive Relation

Author  Topic 

geossl
Yak Posting Veteran

85 Posts

Posted - 2003-11-02 : 23:23:57
Dear All,
There is a table holding the hierarchy of menus as:
MenuID (Primary Key)
ParentMenuID (Null when it is a root menu)
Title

The table allows arbitrary levels of menu. Is it possible to use SQL to get the result as following:

RootMenuID Title MenuID
---------- ----- ------
10 1 10
10 1.1 333
10 1.2 888
10 1.2.1 777
10 1.2.3 388
10 1.3 788
20 2 20
20 2.1 3320
20 2.2 3770
20 2.2.1 7800




Thanks.

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2003-11-02 : 23:31:52
It is possible and there are many good articles on this site.

Related Reading - http://www.sqlteam.com/item.asp?ItemID=8866
Go to Top of Page
   

- Advertisement -