include and join on target month name

This commit is contained in:
Trowbridge 2019-03-06 07:52:38 -05:00
parent caa287b631
commit 6f880d8569
3 changed files with 12 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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