So I have this table, with 3 columns: ID (unique key), PositionID, and SupervisorID. PositionID and SupervisorID are both foreign keys to a Positions table.
What I haven't been able to figure out is a decently nice way of getting inherited subordinates. So for example:
ID PositionID SupervisorID
1 2 1
2 2 3
3 3 4
4 1 5
...
how could I select 2,3 and 4 as based on their subordinate position to 1. The current solution is quite a messy way of doing it, and it seems common enough of a problem that perhaps there is an accepted method.
Thanks.