3
父子树层次结构订单
我必须遵循SQL Server 2008 R2中的数据。SQLFiddle 架构: 创建表[dbo]。[ICFilters]( [ICFilterID] [int] IDENTITY(1,1)NOT NULL, [ParentID] [int] NOT NULL默认值0, [FilterDesc] [varchar](50)NOT NULL, [Active] [tinyint] NOT NULL默认值1, 约束[PK_ICFilters]主键 ([ICFilterID] ASC)与 PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS =开启 )在[PRIMARY]上 )在[PRIMARY]上 插入[dbo]。[ICFilters](ParentID,FilterDesc,活动) 价值观 (0,“产品类型”,1), (1,'ProdSubType_1',1), (1,'ProdSubType_2',1), (1,'ProdSubType_3',1), (1,'ProdSubType_4',1), (2,'PST_1.1',1), (2,'PST_1.2',1), (2,'PST_1.3',1), …