Hierarchical query

  • I have some problems with a creating a Select statement. The query includes 2 tables: tUsers (UserId (PK), ParentId (PK)) and tFamilyConn (UserId, FName, LName, Sex, DateOfBirth, DateOfDeath). Both tables has about 10.000 records (and growing). Table tUsers has 2 PK's and defines Parents of a user. The result of my query is ment to fill a treeview control in a webpage. Is there any samples of queries like this somewhere out there?

  • roy.halvorsen (8/22/2008)


    I have some problems with a creating a Select statement. The query includes 2 tables: tUsers (UserId (PK), ParentId (PK)) and tFamilyConn (UserId, FName, LName, Sex, DateOfBirth, DateOfDeath). Both tables has about 10.000 records (and growing). Table tUsers has 2 PK's and defines Parents of a user. The result of my query is ment to fill a treeview control in a webpage. Is there any samples of queries like this somewhere out there?

    You can create a CTE in such a case, you can go through this link for example http://www.mssqltips.com/tip.asp?tip=1520 .

  • Thanks a lot. Exactly what I was looking for 🙂

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply