diff --git a/index.js b/index.js index 7302d28..fd5cb18 100644 --- a/index.js +++ b/index.js @@ -438,7 +438,7 @@ server.get('/addmonth_v', bodyParser.json(), function (req, res) { --,requestdate-orderdate --,shipdate - requestdate ) - ,targm AS (select s from mseq where m = '` + req.body.month + `' ) + ,targm AS (select s, m from mseq where m = '` + req.body.month + `' ) ,mmixp AS ( SELECT _month @@ -454,7 +454,7 @@ server.get('/addmonth_v', bodyParser.json(), function (req, res) { ) ,closest AS ( SELECT - _month, targm.s + _month, targm.s, targm.m FROM mmixp CROSS JOIN targm @@ -764,7 +764,7 @@ server.get('/addmonth_v', bodyParser.json(), function (req, res) { CROSS JOIN mmixp m CROSS JOIN closest LEFT OUTER JOIN mseq ON - mseq.m = m._month + mseq.m = closest.m LEFT OUTER JOIN gld od ON make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat LEFT OUTER JOIN gld rd ON @@ -994,7 +994,7 @@ server.get('/addmonth_vp', bodyParser.json(), function (req, res) { --,requestdate-orderdate --,shipdate - requestdate ) - ,targm AS (select s from mseq where m = '` + req.body.month + `' ) + ,targm AS (select s, m from mseq where m = '` + req.body.month + `' ) ,mmixp AS ( SELECT _month @@ -1010,7 +1010,7 @@ server.get('/addmonth_vp', bodyParser.json(), function (req, res) { ) ,closest AS ( SELECT - _month, targm.s + _month, targm.s, targm.m FROM mmixp CROSS JOIN targm @@ -1320,7 +1320,7 @@ server.get('/addmonth_vp', bodyParser.json(), function (req, res) { CROSS JOIN mmixp m CROSS JOIN closest LEFT OUTER JOIN mseq ON - mseq.m = m._month + mseq.m = closest.m LEFT OUTER JOIN gld od ON make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat LEFT OUTER JOIN gld rd ON diff --git a/route_meta/addmonth_vd.sql b/route_meta/addmonth_vd.sql index 91149df..affe3d2 100644 --- a/route_meta/addmonth_vd.sql +++ b/route_meta/addmonth_vd.sql @@ -108,7 +108,7 @@ target AS (select 50000 incr) --,requestdate-orderdate --,shipdate - requestdate ) -,targm AS (select s from mseq where m = 'Jul' ) +,targm AS (select s, m from mseq where m = 'Jul' ) ,mmixp AS ( SELECT _month @@ -124,7 +124,7 @@ target AS (select 50000 incr) ) ,closest AS ( SELECT - _month, targm.s + _month, targm.s, m FROM mmixp CROSS JOIN targm @@ -437,7 +437,7 @@ FROM CROSS JOIN mmixp m CROSS JOIN closest LEFT OUTER JOIN mseq ON - mseq.m = m._month + mseq.m = closest.m LEFT OUTER JOIN gld od ON make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat LEFT OUTER JOIN gld rd ON diff --git a/route_meta/addmonth_vupd.sql b/route_meta/addmonth_vupd.sql index 74a3132..8a354b7 100644 --- a/route_meta/addmonth_vupd.sql +++ b/route_meta/addmonth_vupd.sql @@ -111,7 +111,7 @@ target AS (select -50000 vincr, 20000 pincr) --,requestdate-orderdate --,shipdate - requestdate ) -,targm AS (select s from mseq where m = 'Jul' ) +,targm AS (select s, m from mseq where m = 'Jul' ) ,mmixp AS ( SELECT _month @@ -127,7 +127,7 @@ target AS (select -50000 vincr, 20000 pincr) ) ,closest AS ( SELECT - _month, targm.s + _month, targm.s, m FROM mmixp CROSS JOIN targm @@ -441,7 +441,7 @@ FROM CROSS JOIN mmixp m CROSS JOIN closest LEFT OUTER JOIN mseq ON - mseq.m = m._month + mseq.m = closest.m LEFT OUTER JOIN gld od ON make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat LEFT OUTER JOIN gld rd ON