1 WITH SUBQUERY AS (
2 SELECT 3 ORGID 4 FROM 5 OM_ORGANIZATION 6 WHERE 7 PARENTORGID = 'ROOT'
8 UNION ALL
9 SELECT 10 B.ORGID 11 FROM 12 SUBQUERY A, 13 OM_ORGANIZATION B 14 WHERE 15 B.PARENTORGID = A.ORGID
16 ) SELECT DISTINCT 17 * 18 FROM 19 SUBQUERY