Printing tree with SQL CTE
问题 The schema is as follows: CREATE TABLE [Structure]( [StructureId] [uniqueidentifier] NOT NULL, [SequenceNumber] [int] NOT NULL, -- order for siblings, unique per parent [ParentStructureId] [uniqueidentifier] NULL, CONSTRAINT [Structure_PK] PRIMARY KEY CLUSTERED ( [StructureId] ASC ) ) ON [PRIMARY] ALTER TABLE [Structure] WITH CHECK ADD CONSTRAINT [Structure_FK1] FOREIGN KEY([ParentStructureId]) REFERENCES [Structure] ([StructureId]) Currently, I can get all the logical data out with the