Recursive only 2 level records using common sql
- by Tony
I have an Employee table, it's a self-referencing table, with managerId refers to primary key empID. I want to find 2 level records by a given empId. For example: if given empId=5,
if empId=5 has children records, display them, as well as the children in children records.
You may also provide a recursive suggestion without level limitation. The database is SQL Server 2005.