add list of customers

This commit is contained in:
pt 2020-03-12 23:58:39 -04:00
parent f34b0d539d
commit 3540c35629

View File

@ -157,6 +157,17 @@ GROUP BY
('volume') ('volume')
) x(tag) ) x(tag)
) )
,custs AS (
SELECT
bill_cust_descr
,ship_cust_descr
,SUM(value_usd) value_usd
FROM
base
GROUP BY
bill_cust_descr
,ship_cust_descr
)
SELECT SELECT
jsonb_build_object( jsonb_build_object(
'months' 'months'
@ -169,4 +180,6 @@ SELECT
,(SELECT jsonb_agg(row_to_json(totals)::jsonb) FROM totals) ,(SELECT jsonb_agg(row_to_json(totals)::jsonb) FROM totals)
,'tags' ,'tags'
,(SELECT jsonb_agg(tag) FROM tags) ,(SELECT jsonb_agg(tag) FROM tags)
,'customers'
,(SELECT jsonb_agg(row_to_json(custs)::jsonb) FROM custs)
) package ) package