Within SQL , that is called recursion… here is one example http://blog.sqlauthority.com/2012/04/24/sql-server-introduction-to-hierarchical-query-using-a-recursive-cte-a-primer/
From: [email protected] [mailto:[email protected]] On Behalf Of Daniel Ratliff Sent: Sunday, July 28, 2013 8:16 AM To: '[email protected]'; '[email protected]' Subject: RE: [mssms] SQL Help - Stepping down through manager We do something similar and I think it's just one single nested for each. I'll grab the query Monday. -Daniel Ratliff -----Original Message----- From: Todd Hemsell [[email protected]<mailto:[email protected]>] Sent: Sunday, July 28, 2013 09:18 AM Eastern Standard Time To: [email protected]<mailto:[email protected]> Subject: [mssms] SQL Help - Stepping down through manager I want to run a report/query to find everyone that reports to person A or anyone that reports to someone that reports to someone that reports to person A on down, down, down until I get them all. Seems like it would be some sort of nested dynamic SQL. Anyone have any pointers on how to go about something like that? The information transmitted is intended only for the person or entity to which it is addressed and may contain CONFIDENTIAL material. If you receive this material/information in error, please contact the sender and delete or destroy the material/information.

