SQL “tree-like” query - most parent group

后端 未结 6 1213
悲&欢浪女
悲&欢浪女 2020-12-09 07:22

I\'m having some trouble doing a \"tree-like\" query (what do we call this?) in SQL.

Take a look at my diagram below (table and column names are in danish - sorry ab

6条回答
  •  攒了一身酷
    2020-12-09 07:58

    We use SQL Server 2000 and there is an example of expanding hierarchies using a stack in the SQL Books Online, I have written a number of variants for our ERP system

    http://support.microsoft.com/kb/248915

    I gather that there is a Native method using CTE within SQL 2005 but I have not used it myself

提交回复
热议问题