Recursive only 2 level records using common sql

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2010-06-03T10:11:08Z Indexed on 2010/06/03 10:14 UTC
Read the original article Hit count: 157

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about sql

Related posts about database