Well on a side note this is my first post, but seems like an excellent community. Now onto business...
I've looked around at several approaches, but basically I have a table of employees, and one column stores a supervisor ID. For example:
ID
LastName
FirstName
Department
Manager
Title
1
Smith
John
Administration
President
2
Johnson
Sally
Administration
1
Secretary
3
Waters
Andrew
HR
1
HR Manager
4
McNally
Kevin
Sales
1
VP, Sales
5
Watson
Adam
Sales
4
Sales Associate
5
Wilkinson
Mary
Sales
4
Sales associate
I am working on an application for mangers to login and view employee information. I could easily get it working for a manger to view employees directly beneath, but I would like managers to view ALL employees under him. For example, John Smith should see those records of people who directly report to him, but also those that report to people who directly report to him. In this example, John Smith should have access to ALL records. I am using PHP and MySQL, and just can not grasp the SQL queries behind this one. I can imagine using recursion somehow, but i'm fairly new to this.