use inbound segment to hook with exisiting baseline data

This commit is contained in:
Paul Trowbridge 2021-05-12 11:46:02 -04:00
parent 4c926b63e6
commit 1faa832c5b

View File

@ -205,6 +205,7 @@ targ AS (
,factor AS ( ,factor AS (
SELECT SELECT
account account
,segment
,targv ,targv
,targm ,targm
,targc ,targc
@ -217,10 +218,11 @@ FROM
targ t targ t
LEFT OUTER JOIN rlarp.osm_pool o ON LEFT OUTER JOIN rlarp.osm_pool o ON
o.billto_group = t.account o.billto_group = t.account
AND o.segm = 'Retail' AND o.segm = t.segment
AND o.order_season = 2022 AND o.order_season = 2022
GROUP BY GROUP BY
account account
,segment
,targv ,targv
,targm ,targm
,targc ,targc
@ -232,8 +234,8 @@ GROUP BY
rlarp.osm_log(doc) rlarp.osm_log(doc)
SELECT SELECT
$${ $${
"message":"adjust select retail customers to targets sales and margin", "message":"force accounts to match target total value and margin",
"tag":"retail", "tag":"retail plug",
"type":"build" "type":"build"
}$$::jsonb doc }$$::jsonb doc
RETURNING * RETURNING *
@ -298,8 +300,8 @@ GROUP BY
s.account = o.billto_group s.account = o.billto_group
CROSS JOIN log CROSS JOIN log
WHERE WHERE
order_season = 2022 o.order_season = 2022
AND segm = 'Retail' AND o.segm = s.segment
GROUP BY GROUP BY
o.fspr o.fspr
,o.plnt ---master data ,o.plnt ---master data