WITH x AS ( SELECT version, oseas, customer, sum(sales_usd), sum(pounds) --string_agg(distinct mold,', ') FROM b left outer join rlarp.molds m ON m.stlc = b.mold WHERE oseas = 2024 AND version = 'Forecats' GROUP BY version, oseas, customer ) SELECT * FROM X