I need a query that returns who works for who.
My table contains
userID, name, reportsTo
ie.
1 Mary 0
2 John 1
3 Harry 1
4 Tom 2
5 Ann 2
6 Sue 5
So, if my userID is John, then I want the query to return Tom, Ann, Sue. If my userID is
Mary then the query should return John Tom Ann Sue Harry. I guess I also need another indicator for levels because in the last example I don't know that Tom and Harry are at the same level. Please help me sort this out.
Thanks