CREATE CURSOR __parent (ipkey i) APPEND BLANK replace ipkey WITH 001 CREATE CURSOR __child1 (ifk i, namount1 n(10)) APPEND BLANK replace ifk WITH 001 replace namount1 WITH 1000 APPEND BLANK replace ifk WITH 001 replace namount1 WITH 1000 CREATE CURSOR __child2 (ifk i, namount2 n(10)) APPEND BLANK replace ifk WITH 001 replace namount2 WITH 2000 APPEND BLANK replace ifk WITH 001 replace namount2 WITH 2000 APPEND BLANK replace ifk WITH 001 replace namount2 WITH 2000 SELECT sum(__child1.namount1) as __c1, sum(__child2.namount2) as __c2; FROM __parent; left OUTER JOIN __child1 ON __parent.ipkey = __child1.ifk; left OUTER JOIN __child2 ON __parent.ipkey = __child2.ifk; GROUP BY __parent.ipkey