swap out return rows
This commit is contained in:
parent
a4cf5b7607
commit
b3122a50bb
@ -183,29 +183,32 @@ target AS (select target_increment incr)
|
||||
)
|
||||
--select sum(value_usd), count(*) from final
|
||||
, ins AS (
|
||||
INSERT INTO rlarp.osm_fcpool SELECT * FROM final RETURNING *
|
||||
INSERT INTO rlarp.osm_pool SELECT * FROM final RETURNING *
|
||||
)
|
||||
,insagg AS (
|
||||
SELECT
|
||||
---------customer info-----------------
|
||||
bill_cust_descr
|
||||
,billto_group
|
||||
,ship_cust_descr
|
||||
,shipto_group
|
||||
,quota_rep_descr
|
||||
,director_descr
|
||||
,director
|
||||
,segm
|
||||
,mod_chan
|
||||
,mod_chansub
|
||||
,chan
|
||||
,chansub
|
||||
---------product info------------------
|
||||
,majg_descr
|
||||
,ming_descr
|
||||
,majs_descr
|
||||
,mins_descr
|
||||
,brand
|
||||
,part_family
|
||||
--,brand
|
||||
--,part_family
|
||||
,part_group
|
||||
,branding
|
||||
,color
|
||||
--,color
|
||||
,part_descr
|
||||
---------dates-------------------------
|
||||
,order_season
|
||||
,order_month
|
||||
,ship_season
|
||||
@ -215,6 +218,7 @@ SELECT
|
||||
,promo
|
||||
,version
|
||||
,iter
|
||||
--------values-------------------------
|
||||
,sum(value_loc) value_loc
|
||||
,sum(value_usd) value_usd
|
||||
,sum(cost_loc) cost_loc
|
||||
@ -223,25 +227,28 @@ SELECT
|
||||
FROM
|
||||
ins
|
||||
GROUP BY
|
||||
---------customer info-----------------
|
||||
bill_cust_descr
|
||||
,billto_group
|
||||
,ship_cust_descr
|
||||
,shipto_group
|
||||
,quota_rep_descr
|
||||
,director_descr
|
||||
,director
|
||||
,segm
|
||||
,mod_chan
|
||||
,mod_chansub
|
||||
,chan
|
||||
,chansub
|
||||
---------product info------------------
|
||||
,majg_descr
|
||||
,ming_descr
|
||||
,majs_descr
|
||||
,mins_descr
|
||||
,brand
|
||||
,part_family
|
||||
--,brand
|
||||
--,part_family
|
||||
,part_group
|
||||
,branding
|
||||
,color
|
||||
--,color
|
||||
,part_descr
|
||||
---------dates-------------------------
|
||||
,order_season
|
||||
,order_month
|
||||
,ship_season
|
||||
|
Loading…
Reference in New Issue
Block a user