Listing 5: Query That Returns Managers with More than Two Subordinates SELECT M.EmployeeID AS mgrid, M.FirstName + ' ' + M.LastName AS mgrname FROM dbo.Employees AS M WHERE (SELECT COUNT(*) FROM dbo.fn_getsubtree(M.EmployeeID)) - 1 > 2;