Traversing a tree - using a little recursion in SQL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dhettlinger
    New Member
    • Jul 2008
    • 1

    Traversing a tree - using a little recursion in SQL

    I'm attempting to write some SQL code in Oracle 10g to pull data from a tree structure. Basically, I have a users table, and each user is assigned to a manager. (The user's manager's ID is kept in the manager field of the user's entry in the users table.) From this tree structure, I want to pull a list of all users who report either directly or indirectly to a particular division head (top level manager). I imagine that this query would involve some recursion, but I am not doing well figuring out how to write it in SQL. Any suggestions?
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    you need to use connect by prior for the purpose.

    Comment

    Working...