Hi,
I am trying to get my head around this problem. I am designing an application that allows our sales force to login and do a multiple choice test to assess their knowledge of our company's products.
The problem I have is that I need to return test results for all people that sit beneath a particular director/manager within the company.
For example:
When a director or manager logs in, they will want to be able to see records for all the users that are beneath them. So Director 1 should only see records for Managers 1 & 2 and Users 1-4. Director 2 should only see records for Manager 3 & 4 and Users 5-8. Manager 2 should only see records for Users 3 & 4.
I am unsure of the best way to structure my users table in the database.
Should all users, managers, directors be in a single table? Managers need to take this test as well so they could also be considered as users.
How should I structure the SQL query to return all the relevant records based on the ID of the logged in user?
I'm not after a complete solution, just need some guidance really on where to start.
Thanks guys and girls.
Tony
---------------------------------------
I am trying to get my head around this problem. I am designing an application that allows our sales force to login and do a multiple choice test to assess their knowledge of our company's products.
The problem I have is that I need to return test results for all people that sit beneath a particular director/manager within the company.
For example:
Code:
o Director 1 o Director 2
/ \ / \
/ \ / \
Mgr 1 o o Mgr 2 Mgr 3 o o Mgr 4
/ \ / \ / \ / \
o o o o o o o o
Users 1 2 3 4 5 6 7 8
When a director or manager logs in, they will want to be able to see records for all the users that are beneath them. So Director 1 should only see records for Managers 1 & 2 and Users 1-4. Director 2 should only see records for Manager 3 & 4 and Users 5-8. Manager 2 should only see records for Users 3 & 4.
I am unsure of the best way to structure my users table in the database.
Should all users, managers, directors be in a single table? Managers need to take this test as well so they could also be considered as users.
How should I structure the SQL query to return all the relevant records based on the ID of the logged in user?
I'm not after a complete solution, just need some guidance really on where to start.
Thanks guys and girls.
Tony
---------------------------------------