How to display parent id for itself and children with T-sql recursive query
问题 I am working on recursive query which take table with parent-child relation ID | ParentID | description 1 | null | Company 2 | 1 | Department 3 | 2 | Unit1 4 | 2 | Unit2 5 | 4 | Unit3 6 | 4 | Unit4 and is suppose to display following result: ID | ParentID | description 1 | null | Company 2 | 2 | Department 3 | 2 | Unit1 4 | 2 | Unit2 5 | 2 | Unit3 6 | 2 | Unit4 Of course the number of Deparments and units is larger. The basic quest is to display parentId for parent and its child level. Do you