increment year

This commit is contained in:
pt 2020-02-15 03:26:04 -05:00
parent c602564cb7
commit e7ce48405b

View File

@ -320,14 +320,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 + 2020,mseq.cal,m.odom) order_date ,make_date(mseq.yr + 2021,mseq.cal,m.odom) order_date
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom),'Mon') order_month ,to_char(make_date(mseq.yr + 2021,mseq.cal,m.odom),'Mon') order_month
,od.ssyr order_season ,od.ssyr order_season
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag request_date ,make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag request_date
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag,'Mon') request_month ,to_char(make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag,'Mon') request_month
,rd.ssyr request_season ,rd.ssyr request_season
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag ship_date ,make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag + slag ship_date
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month ,to_char(make_date(mseq.yr + 2021,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
@ -343,11 +343,11 @@ FROM
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 + 2020,mseq.cal,m.odom) BETWEEN od.sdat AND od.edat make_date(mseq.yr + 2021,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 + 2020,mseq.cal,m.odom) + rlag BETWEEN rd.sdat AND rd.edat make_date(mseq.yr + 2021,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 + 2020,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat make_date(mseq.yr + 2021,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)
) )