I have a table CH in SQL Server 2005 with columns ParentID (PK) and childID. ChildID could be the ParentID of Another ChildID. I want all the ChildID that are also the ParentIDs.
I have tried this:
Select ParentID From (Select ChildID from ch) ch
But it does not work.