How to find decendants?

This image shows an example of the data relationships I have. I’ve used schools to make it easy to visualize.

For any school I can easy show what teachers are at that school e.g for school A1 I would have Bob and Jane.
What I want to do is if I am at a county level is to get all teachers of that county e.g for county A1 would return the teachers Bob, Jane, James and Derek
And if I am at the state level it would return all teachers below this state.
Is there any way to do this?

The only way I can think of doing it is store for each teacher an array of ids that correspond to each level up then when I’m at a state or county level search for all teachers and see if that state or county id exists in the teachers array.

I think you should structure your data so each teacher has a State, County, and School column. Every School should have a State and County column. Every County should have a State column. Then it will be easy to relate everything together.

The state, county and schools was just an example. In my application the user is able to create as many levels as they want. It’s just generic tree that can be as big as they want