swap out returning columns

This commit is contained in:
Trowbridge 2020-02-13 12:48:51 -05:00
parent fb7fdc7959
commit f83746b892

View File

@ -290,70 +290,77 @@ FROM
INSERT INTO rlarp.osm_pool (SELECT * FROM pricing UNION ALL SELECT * FROM volume) RETURNING * INSERT INTO rlarp.osm_pool (SELECT * FROM pricing UNION ALL SELECT * FROM volume) RETURNING *
) )
,insagg AS ( ,insagg AS (
SELECT SELECT
bill_cust_descr ---------customer info-----------------
,billto_group bill_cust_descr
,ship_cust_descr ,billto_group
,shipto_group ,ship_cust_descr
,quota_rep_descr ,shipto_group
,director_descr ,quota_rep_descr
,segm ,director
,mod_chan ,segm
,mod_chansub ,chan
,majg_descr ,chansub
,ming_descr ---------product info------------------
,majs_descr ,majg_descr
,mins_descr ,ming_descr
,brand ,majs_descr
,part_family ,mins_descr
,part_group --,brand
,branding --,part_family
,color ,part_group
,part_descr ,branding
,order_season --,color
,order_month ,part_descr
,ship_season ---------dates-------------------------
,ship_month ,order_season
,request_season ,order_month
,request_month ,ship_season
,promo ,ship_month
,version ,request_season
,iter ,request_month
,sum(value_loc) value_loc ,promo
,sum(value_usd) value_usd ,version
,sum(cost_loc) cost_loc ,iter
,sum(cost_usd) cost_usd --------values-------------------------
,sum(units) units ,sum(value_loc) value_loc
FROM ,sum(value_usd) value_usd
ins ,sum(cost_loc) cost_loc
GROUP BY ,sum(cost_usd) cost_usd
bill_cust_descr ,sum(units) units
,billto_group FROM
,ship_cust_descr ins
,shipto_group GROUP BY
,quota_rep_descr ---------customer info-----------------
,director_descr bill_cust_descr
,segm ,billto_group
,mod_chan ,ship_cust_descr
,mod_chansub ,shipto_group
,majg_descr ,quota_rep_descr
,ming_descr ,director
,majs_descr ,segm
,mins_descr ,chan
,brand ,chansub
,part_family ---------product info------------------
,part_group ,majg_descr
,branding ,ming_descr
,color ,majs_descr
,part_descr ,mins_descr
,order_season --,brand
,order_month --,part_family
,ship_season ,part_group
,ship_month ,branding
,request_season --,color
,request_month ,part_descr
,promo ---------dates-------------------------
,version ,order_season
,iter ,order_month
,ship_season
,ship_month
,request_season
,request_month
,promo
,version
,iter
) )
SELECT json_agg(row_to_json(insagg)) x from insagg SELECT json_agg(row_to_json(insagg)) x from insagg