See 'Expanding Hierarchies' in BOL for stored procedure code.
>Hi All,
>
>What I am trying to do is select a bunch of records from a table that are linked to other records within that table.
>
>ie
>
>with a set of data like :
>
>RecordID ParentID
>1 0
>2 1
>3 0
>4 2
>5 3
>
>
>Getting all the records for RecordID = 1 would bring through :
>
>RecordID ParentID
>1 0
>2 1
>4 2
>
>
>What would be the best way to do this in SQL Server 7 (If its possible)?
>
>Thanks,
>
>Michael Henstock
>AWS
--sb--