created join statement for: getSubnodesByTree