Self-joining query to find descendants of a node syntax issue
I have a self-linking table that records one record for every "Step" in a process (Step.ParentStepId is a foreign key to Step.StepId): CREATE TABLE [dbo].[Step]( [StepId] [int] IDENTITY(1,1) NOT NULL, [Name] [varchar](50) NOT NULL, [Description] [text] NULL, [Sequence] [int] NULL, [ParentStepId] [int] NULL, CONSTRAINT [PK_Step] PRIMARY KEY CLUSTERED ( [StepId] ASC ) ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] ALTER TABLE [dbo].[Step] WITH CHECK ADD CONSTRAINT [FK_Step_Step] FOREIGN KEY([ParentStepId]) REFERENCES [dbo].[Step] ([StepId]) I'd like to write a query to return all of the Steps where a