Add "root hierarchy" sub-query to reduce duplication.