var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Listing tasks for a particular manager and all his employees
In a 3-level structure company, there is the president, some managers and employees with a table showing the boss as:
id name boss
1 president NULL
2 manager1 1
3 manager2 1
4 employee1 2
There is another table for tasks assigned to either managers or employees:
id assigned_to notes
1 2 blah
2 4 foo
My question is: given a user, how to list tasks assigned to him and all employees reporting to him. For example, if the user is a manager, how to list tasks assigned to this manager and all his employees.
Use self-(outer)-join twice to know the employees reporting to the person.
In a 3-level structure company, ...
Then, use three left joins to know tasks assigned to the person and the employees.
If there were more levels, it may be better to use other techniques.
For example, recursive query.
But, I don't know wheather(and how) MySQL supports recursive query or not.
consider using the
I'd rather be riding on the Tiger 800 or the Norton
Thanks all for the replies. I will try to come up with the SQL statement to achieve that. Thanks again.