I need to transform a list to rows to be added later, the list comes from rows in a grouped select
select
retail ,
listagg( distinct trn.header_id::varchar||'_'||trn.total_sale::varchar,',') as "total_sale"
from
ventas.mw_mdh_transactions trn
group by
retail
I need to read the list and add it up in the same query. All this in REDSHIFT.
for example this ...
select
retail ,
select z from unnest(listagg( distinct trn.header_id::varchar||'_'||trn.total_sale::varchar,',')) z as "total_sale"
from
ventas.mw_mdh_transactions trn
group by
retail