Compare commits

..

No commits in common. "53ac7f90e2baebafbd2429359d5b806e0fddf83e" and "a83708a7ca969e854d694323f38419f9a7097cd7" have entirely different histories.

2 changed files with 15 additions and 22 deletions

View File

@ -193,7 +193,6 @@ SELECT
o.plnt o.plnt
--promo in next step --promo in next step
--terms in next step --terms in next step
,c.bvterm terms
,o.bill_cust_descr ,o.bill_cust_descr
,o.ship_cust_descr ,o.ship_cust_descr
,o.dsm ,o.dsm
@ -221,14 +220,11 @@ SELECT
,sum(coalesce(o.units,0)) units ,sum(coalesce(o.units,0)) units
,sum(coalesce(o.value_loc,0)) value_loc ,sum(coalesce(o.value_loc,0)) value_loc
,sum(coalesce(o.value_usd,0)) value_usd ,sum(coalesce(o.value_usd,0)) value_usd
,sum(coalesce(o.cost_loc,0)) cost_loc ,sum(coalesce(o.cost_loc,0)) cost_usd
,sum(coalesce(o.cost_usd,0)) cost_usd
,o.calc_status ,o.calc_status
,o.flag ,o.flag
FROM FROM
rlarp.osm_pool o rlarp.osm_pool o
LEFT OUTER JOIN lgdat.cust c ON
c.bvcust = rtrim(substr(o.bill_cust_descr,1,8))
WHERE WHERE
-----------------scenario---------------------------- -----------------scenario----------------------------
where_clause where_clause
@ -243,7 +239,6 @@ SELECT
GROUP BY GROUP BY
--fspr in next step --fspr in next step
o.plnt o.plnt
,c.bvterm
--promo in next step --promo in next step
--terms in next step --terms in next step
,o.bill_cust_descr ,o.bill_cust_descr
@ -320,14 +315,14 @@ SELECT
,b.cost_usd*s.factor*m.momix cost_usd ,b.cost_usd*s.factor*m.momix cost_usd
,b.calc_status ,b.calc_status
,b.flag ,b.flag
,make_date(mseq.yr + 2021,mseq.cal,m.odom) order_date ,make_date(mseq.yr + 2020,mseq.cal,m.odom) order_date
,to_char(make_date(mseq.yr + 2021,mseq.cal,m.odom),'Mon') order_month ,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom),'Mon') order_month
,od.ssyr order_season ,od.ssyr order_season
,make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag request_date ,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag request_date
,to_char(make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag,'Mon') request_month ,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag,'Mon') request_month
,rd.ssyr request_season ,rd.ssyr request_season
,make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag + slag ship_date ,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag ship_date
,to_char(make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month ,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month
,sd.ssyr ship_season ,sd.ssyr ship_season
,'replace_version' "version" ,'replace_version' "version"
,'replace_source'||' volume' iter ,'replace_source'||' volume' iter
@ -339,15 +334,14 @@ FROM
CROSS JOIN vscale s CROSS JOIN vscale s
CROSS JOIN mmixp m CROSS JOIN mmixp m
CROSS JOIN closest CROSS JOIN closest
CROSS JOIN log
LEFT OUTER JOIN mseq ON LEFT OUTER JOIN mseq ON
mseq.m = closest.m mseq.m = closest.m
LEFT OUTER JOIN gld od ON LEFT OUTER JOIN gld od ON
make_date(mseq.yr + 2021,mseq.cal,m.odom) BETWEEN od.sdat AND od.edat make_date(mseq.yr + 2020,mseq.cal,m.odom) BETWEEN od.sdat AND od.edat
LEFT OUTER JOIN gld rd ON LEFT OUTER JOIN gld rd ON
make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag BETWEEN rd.sdat AND rd.edat make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
LEFT OUTER JOIN gld sd ON LEFT OUTER JOIN gld sd ON
make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
WHERE WHERE
m._month = (SELECT _month FROM closest) m._month = (SELECT _month FROM closest)
) )
@ -373,9 +367,9 @@ WHERE
) )
,price AS ( ,price AS (
SELECT SELECT
b.fspr sd.fspr
,b.plnt ,b.plnt
,b.promo ,m.promo
,b.terms ,b.terms
,b.bill_cust_descr ,b.bill_cust_descr
,b.ship_cust_descr ,b.ship_cust_descr
@ -425,7 +419,6 @@ SELECT
FROM FROM
volume b volume b
CROSS JOIN pscale p CROSS JOIN pscale p
CROSS JOIN log
WHERE WHERE
p.factor <> 0 or p.mod_price <> 0 p.factor <> 0 or p.mod_price <> 0
) )

View File

@ -90,13 +90,13 @@ SELECT
,calc_status ,calc_status
,flag ,flag
,o.odate order_date ,o.odate order_date
,to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') order_month ,to_char(CASE WHEN extract(month FROM o.odate) > 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') order_month
,oseas order_season ,oseas order_season
,rdate request_date ,rdate request_date
,to_char(CASE WHEN extract(month FROM o.rdate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.rdate),'FM00')||' - '||to_char(o.rdate,'TMMon') request_month ,to_char(CASE WHEN extract(month FROM o.rdate) > 6 THEN -5 ELSE 7 END + extract(month FROM o.rdate),'FM00')||' - '||to_char(o.rdate,'TMMon') request_month
,rseas request_season ,rseas request_season
,sdate ship_date ,sdate ship_date
,to_char(CASE WHEN extract(month FROM o.sdate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.sdate),'FM00')||' - '||to_char(o.sdate,'TMMon') ship_month ,to_char(CASE WHEN extract(month FROM o.sdate) > 6 THEN -5 ELSE 7 END + extract(month FROM o.sdate),'FM00')||' - '||to_char(o.sdate,'TMMon') ship_month
,sseas ship_season ,sseas ship_season
,version ,version
,iter ,iter