|
I am able to extract all the information required but not getting managers in the resultset. My resultset lists all consultants, but not who their managers are
(comments are locked)
|
|
Below is a rudimentary table schemas of CareerLevel and Consultant. Any consultant who has a careerlevel of 6 or more is a director and has other consultants under him/her CareerLevel Table CareerLevelID int CareerLevel int CareerLevelName varchar Consultant Table ConsultantID int Consultant varchar CareerLevel int (if consultant careerlevel >= 6, then consultant is director) IsDirector int Firstname LastName Below is a rudimentary table schemas of CareerLevel and Consultant. Any consultant who has a careerlevel of 6 or more is a director and has other consultants under him/her CareerLevel Table CareerLevelID int CareerLevel int CareerLevelName varchar Consultant Table ConsultantID int Consultant varchar CareerLevel int (if consultant careerlevel >= 6, then consultant is director) IsDirector int Firstname LastName
Oct 02 '12 at 03:39 PM
natongm
(comments are locked)
|


How would you know who is the manager of a consultant. Your query contains no tracks of a ManagerID (or similar) column, nor did you post any DDL for your tables, so it's hard to tell.
On a more conceptual note: Look at recursive CTEs.
CareerLevelID determines if a consultant is a director or not. So, I am looking to display the names of directors as well as the consultants below them. CareerLevel 6+ is director
CareerLevelID determines if director or not. CareerLevelID of 6 and up is director level. CareerLevelID is a flag in Consultant table.
Table schemas would be helpful here. For example why would a manager be listed in a consultant table? It doesn't make a lot of sense.
Ok. So now we know who is à director. But My question was about the relation a consultant has to à director. How do one know which director is Consultant A:s manager?