suffix listing format adjustment, and don't group on conversion factor, just pick the biggest one

This commit is contained in:
Paul Trowbridge 2021-01-13 00:10:33 -05:00
parent e040132bce
commit 89737cf358

View File

@ -213,17 +213,17 @@ WHERE
SELECT SELECT
plist plist
,stlc ,stlc
,string_agg(DISTINCT coltier ,', ') FILTER (WHERE clist IS NOT NULL) coltier ,string_agg(DISTINCT coltier ,',') FILTER (WHERE clist IS NOT NULL) coltier
,string_agg(DISTINCT branding,', ') branding ,string_agg(DISTINCT branding,',') branding
-------replace blank with 'none'-------------- -------replace blank with 'none'--------------
,regexp_replace(string_agg(DISTINCT accs ,', '),'^,','none,','g') accs ,regexp_replace(string_agg(DISTINCT accs ,','),'^,','','g') accs
,string_agg(DISTINCT suffix ,', ') suffix ,regexp_replace(string_agg(DISTINCT suffix ,','),'^,','','g') suffix
,pckg ,pckg
,col ,col
,vol_uom ,vol_uom
,voL_qty ,voL_qty
,nm ,max(nm) nm
,dm ,max(dm) dm
,price ,price
-----convert json array to a plain text representation as well as remove nulls------ -----convert json array to a plain text representation as well as remove nulls------
,regexp_replace(jsonb_arr_aggcd(clist)::text,'["\[\]]|null, ','','g') clist ,regexp_replace(jsonb_arr_aggcd(clist)::text,'["\[\]]|null, ','','g') clist
@ -236,13 +236,11 @@ WHERE
,col ,col
,vol_uom ,vol_uom
,vol_qty ,vol_qty
,nm
,dm
,price ,price
) )
,seq_levels AS ( ,seq_levels AS (
SELECT SELECT
plist||'.'||stlc||'.'||pckg||'.'||col||'.'||to_char(row_number() OVER (PARTITION BY plist, stlc, col ORDER BY price ASC),'FM00') lookup plist||'.'||stlc||'.'||pckg||'.'||col||'.'||to_char(row_number() OVER (PARTITION BY plist, stlc, pckg, col ORDER BY price ASC),'FM00') lookup
,plist ,plist
,stlc ,stlc
,coltier ,coltier