aggregate attributes to the price level

This commit is contained in:
Paul Trowbridge 2021-01-12 00:47:00 -05:00
parent 01b70dce3c
commit 460912af7c

View File

@ -228,9 +228,27 @@ ORDER BY
,agg_levels AS (
SELECT
stlc
,jsonb_agg(DISTINCT coltier) coltier
,jsonb_agg(branding)
,jsonb_agg(DISTINCT
,jsonb_agg(DISTINCT
,jsonb_agg(DISTINCT
,string_agg(DISTINCT coltier ,', ') FILTER (WHERE clist IS NOT NULL) coltier
,string_agg(DISTINCT branding,', ') branding
,string_agg(DISTINCT accs ,', ') accs
,string_agg(DISTINCT suffix ,', ') suffix
,pckg
,col
,vol_uom
,voL_qty
,price
,regexp_replace(jsonb_arr_aggcd(clist)::text,'["\[\]]|null, ','','g') clist
FROM
joinback_init
GROUP BY
stlc
,pckg
,col
,vol_uom
,vol_qty
,price
)
SELECT
*
FROM
agg_levels