diff --git a/route_sql/addmonth_vupd.sql b/route_sql/addmonth_vupd.sql index 14110ff..1ab28c4 100644 --- a/route_sql/addmonth_vupd.sql +++ b/route_sql/addmonth_vupd.sql @@ -320,14 +320,14 @@ SELECT ,b.cost_usd*s.factor*m.momix cost_usd ,b.calc_status ,b.flag - ,make_date(mseq.yr + 2020,mseq.cal,m.odom) order_date - ,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom),'Mon') order_month + ,make_date(mseq.yr + 2021,mseq.cal,m.odom) order_date + ,to_char(make_date(mseq.yr + 2021,mseq.cal,m.odom),'Mon') order_month ,od.ssyr order_season - ,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag request_date - ,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag,'Mon') request_month + ,make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag request_date + ,to_char(make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag,'Mon') request_month ,rd.ssyr request_season - ,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag ship_date - ,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month + ,make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag + slag ship_date + ,to_char(make_date(mseq.yr + 2021,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month ,sd.ssyr ship_season ,'replace_version' "version" ,'replace_source'||' volume' iter @@ -343,11 +343,11 @@ FROM LEFT OUTER JOIN mseq ON mseq.m = closest.m 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 - 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 - 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 m._month = (SELECT _month FROM closest) )