Can now pull the data, but am wondering if there is a better way to optimize the query for large data sets.
http://sqlfiddle.com/#!4/0ef0c/5
So basically I want to be able to supply the query a given org id and have it recursively pull its parents, its children, its siblings and its aunts and uncles. And then pull any Activities that are associated with that org hierarchy.
Org1 is the top level org, but it may or may not have a null parent.
Basically I was doing an up and down query to pull the children and the parent, but can only seem to get the siblings by adding another query. Finally got to another query with the help of a friend, but its very low on large data sets (4-5k of Activities).
Any insight would be greatly appreciated.