WITH a(c1) AS ( SELECT 'A' FROM dual UNION ALL SELECT 'B' FROM dual UNION ALL SELECT 'C' FROM dual ) , b(c2) AS ( SELECT 'a' FROM dual UNION ALL SELECT 'b' FROM dual UNION ALL SELECT 'c' FROM dual UNION ALL SELECT 'd' FROM dual ) , c(c3, v) AS ( SELECT 'A-a', 20 FROM dual UNION ALL SELECT 'A-c', 30 FROM dual UNION ALL SELECT 'B-d', 20 FROM dual UNION ALL SELECT 'C-a', 10 FROM dual UNION ALL SELECT 'A-a', 10 FROM dual ) SELECT a.c1 ||'-'|| b.c2 c3 , c.v FROM a CROSS JOIN b LEFT OUTER JOIN (SELECT c3, SUM(v) v FROM c GROUP BY c3) c ON a.c1 ||'-'|| b.c2 = c.c3 ORDER BY c3 ;