include and join on target month name
This commit is contained in:
parent
caa287b631
commit
6f880d8569
12
index.js
12
index.js
@ -438,7 +438,7 @@ server.get('/addmonth_v', bodyParser.json(), function (req, res) {
|
|||||||
--,requestdate-orderdate
|
--,requestdate-orderdate
|
||||||
--,shipdate - requestdate
|
--,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 (
|
,mmixp AS (
|
||||||
SELECT
|
SELECT
|
||||||
_month
|
_month
|
||||||
@ -454,7 +454,7 @@ server.get('/addmonth_v', bodyParser.json(), function (req, res) {
|
|||||||
)
|
)
|
||||||
,closest AS (
|
,closest AS (
|
||||||
SELECT
|
SELECT
|
||||||
_month, targm.s
|
_month, targm.s, targm.m
|
||||||
FROM
|
FROM
|
||||||
mmixp
|
mmixp
|
||||||
CROSS JOIN targm
|
CROSS JOIN targm
|
||||||
@ -764,7 +764,7 @@ server.get('/addmonth_v', bodyParser.json(), function (req, res) {
|
|||||||
CROSS JOIN mmixp m
|
CROSS JOIN mmixp m
|
||||||
CROSS JOIN closest
|
CROSS JOIN closest
|
||||||
LEFT OUTER JOIN mseq ON
|
LEFT OUTER JOIN mseq ON
|
||||||
mseq.m = m._month
|
mseq.m = closest.m
|
||||||
LEFT OUTER JOIN gld od ON
|
LEFT OUTER JOIN gld od ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
||||||
LEFT OUTER JOIN gld rd ON
|
LEFT OUTER JOIN gld rd ON
|
||||||
@ -994,7 +994,7 @@ server.get('/addmonth_vp', bodyParser.json(), function (req, res) {
|
|||||||
--,requestdate-orderdate
|
--,requestdate-orderdate
|
||||||
--,shipdate - requestdate
|
--,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 (
|
,mmixp AS (
|
||||||
SELECT
|
SELECT
|
||||||
_month
|
_month
|
||||||
@ -1010,7 +1010,7 @@ server.get('/addmonth_vp', bodyParser.json(), function (req, res) {
|
|||||||
)
|
)
|
||||||
,closest AS (
|
,closest AS (
|
||||||
SELECT
|
SELECT
|
||||||
_month, targm.s
|
_month, targm.s, targm.m
|
||||||
FROM
|
FROM
|
||||||
mmixp
|
mmixp
|
||||||
CROSS JOIN targm
|
CROSS JOIN targm
|
||||||
@ -1320,7 +1320,7 @@ server.get('/addmonth_vp', bodyParser.json(), function (req, res) {
|
|||||||
CROSS JOIN mmixp m
|
CROSS JOIN mmixp m
|
||||||
CROSS JOIN closest
|
CROSS JOIN closest
|
||||||
LEFT OUTER JOIN mseq ON
|
LEFT OUTER JOIN mseq ON
|
||||||
mseq.m = m._month
|
mseq.m = closest.m
|
||||||
LEFT OUTER JOIN gld od ON
|
LEFT OUTER JOIN gld od ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
||||||
LEFT OUTER JOIN gld rd ON
|
LEFT OUTER JOIN gld rd ON
|
||||||
|
@ -108,7 +108,7 @@ target AS (select 50000 incr)
|
|||||||
--,requestdate-orderdate
|
--,requestdate-orderdate
|
||||||
--,shipdate - requestdate
|
--,shipdate - requestdate
|
||||||
)
|
)
|
||||||
,targm AS (select s from mseq where m = 'Jul' )
|
,targm AS (select s, m from mseq where m = 'Jul' )
|
||||||
,mmixp AS (
|
,mmixp AS (
|
||||||
SELECT
|
SELECT
|
||||||
_month
|
_month
|
||||||
@ -124,7 +124,7 @@ target AS (select 50000 incr)
|
|||||||
)
|
)
|
||||||
,closest AS (
|
,closest AS (
|
||||||
SELECT
|
SELECT
|
||||||
_month, targm.s
|
_month, targm.s, m
|
||||||
FROM
|
FROM
|
||||||
mmixp
|
mmixp
|
||||||
CROSS JOIN targm
|
CROSS JOIN targm
|
||||||
@ -437,7 +437,7 @@ FROM
|
|||||||
CROSS JOIN mmixp m
|
CROSS JOIN mmixp m
|
||||||
CROSS JOIN closest
|
CROSS JOIN closest
|
||||||
LEFT OUTER JOIN mseq ON
|
LEFT OUTER JOIN mseq ON
|
||||||
mseq.m = m._month
|
mseq.m = closest.m
|
||||||
LEFT OUTER JOIN gld od ON
|
LEFT OUTER JOIN gld od ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
||||||
LEFT OUTER JOIN gld rd ON
|
LEFT OUTER JOIN gld rd ON
|
||||||
|
@ -111,7 +111,7 @@ target AS (select -50000 vincr, 20000 pincr)
|
|||||||
--,requestdate-orderdate
|
--,requestdate-orderdate
|
||||||
--,shipdate - requestdate
|
--,shipdate - requestdate
|
||||||
)
|
)
|
||||||
,targm AS (select s from mseq where m = 'Jul' )
|
,targm AS (select s, m from mseq where m = 'Jul' )
|
||||||
,mmixp AS (
|
,mmixp AS (
|
||||||
SELECT
|
SELECT
|
||||||
_month
|
_month
|
||||||
@ -127,7 +127,7 @@ target AS (select -50000 vincr, 20000 pincr)
|
|||||||
)
|
)
|
||||||
,closest AS (
|
,closest AS (
|
||||||
SELECT
|
SELECT
|
||||||
_month, targm.s
|
_month, targm.s, m
|
||||||
FROM
|
FROM
|
||||||
mmixp
|
mmixp
|
||||||
CROSS JOIN targm
|
CROSS JOIN targm
|
||||||
@ -441,7 +441,7 @@ FROM
|
|||||||
CROSS JOIN mmixp m
|
CROSS JOIN mmixp m
|
||||||
CROSS JOIN closest
|
CROSS JOIN closest
|
||||||
LEFT OUTER JOIN mseq ON
|
LEFT OUTER JOIN mseq ON
|
||||||
mseq.m = m._month
|
mseq.m = closest.m
|
||||||
LEFT OUTER JOIN gld od ON
|
LEFT OUTER JOIN gld od ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
||||||
LEFT OUTER JOIN gld rd ON
|
LEFT OUTER JOIN gld rd ON
|
||||||
|
Loading…
Reference in New Issue
Block a user