This discussion is archived
1 Reply Latest reply: Jun 4, 2013 11:31 PM by Marwim RSS

How to dynamically populate a manager name and level for any user who login

user599926 Newbie
Currently Being Moderated
Hi All,

I need some help in doing this in my DB:


Table 1 is the the manager hierarchy {which basically shows the structure of every employee's org).

Table 2 is a list of all people manager ( all these usernames will also be in table 1). What i need to find is using the username from Table 2, the highest level that username exists in the manager hierarchy.

For ex:

Table 1: { What this shows is Sam is CEO and Jeff reports to him. So for Sam, he will exist on all 15 levels and Jeff will have Sam has his top level manager and then Jeff will repeat for all remaining levels till 15.

Manager Level 0  Level 1  Level 2 Level 3...Level15

Sam                       Sam     Sam     Sam         Sam

Sam                        Jeff     Jeff        Jeff          Jeff

Now in Table 2:

User Name   Manager Level/Name

Sam               Manager Level 0 Sam

Jeff                 Manager Level 1 Jeff

As you see, for each user name in Table i want to populate their high level from the manager hierarchy {their record in manager hierarchy).

Hope This helps to clear the confusion.

Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points