Hi
This is the problem:
I have a Users Table with a field named Reports_to which stores the ID of another user!
Now i have another table which stored Leave Applications of the users (or employees). These leave applications are only viewable by an assigned person for approval. This is found out by checking who reports to whom!
If I Nick report to JAck then when Jack loads the Approval Section he will see my Leave Applications for him to approve! But if Jack is to Report to Joe then Joe can see Jack's Applications and Nick's Applications! This can go on for ever!! (or quite)
How can i construct a simple SQL to retrieve all those that fall under a particular user?
Thanks
Nick
This is the problem:
I have a Users Table with a field named Reports_to which stores the ID of another user!
Now i have another table which stored Leave Applications of the users (or employees). These leave applications are only viewable by an assigned person for approval. This is found out by checking who reports to whom!
If I Nick report to JAck then when Jack loads the Approval Section he will see my Leave Applications for him to approve! But if Jack is to Report to Joe then Joe can see Jack's Applications and Nick's Applications! This can go on for ever!! (or quite)
How can i construct a simple SQL to retrieve all those that fall under a particular user?
Thanks
Nick