forecaste name, insert statement, delete statement , and orders cutuff
This commit is contained in:
parent
8da4a929e0
commit
06488cae18
@ -50,7 +50,7 @@ $a$SELECT
|
|||||||
$a$::text||
|
$a$::text||
|
||||||
_clist||
|
_clist||
|
||||||
$b$
|
$b$
|
||||||
,'baseline' "version"
|
,'forecast_name' "version"
|
||||||
,'actuals' iter
|
,'actuals' iter
|
||||||
FROM
|
FROM
|
||||||
rlarp.osm_dev o
|
rlarp.osm_dev o
|
||||||
@ -77,7 +77,7 @@ SELECT
|
|||||||
$$SELECT
|
$$SELECT
|
||||||
$$||_clist_inc||
|
$$||_clist_inc||
|
||||||
$$
|
$$
|
||||||
,'baseline' "version"
|
,'forecast_name' "version"
|
||||||
,'plug' iter
|
,'plug' iter
|
||||||
FROM
|
FROM
|
||||||
rlarp.osm_dev o
|
rlarp.osm_dev o
|
||||||
@ -91,13 +91,20 @@ INTO
|
|||||||
------------------------------copy a full year and increment by 1 year for the baseline-------------------------
|
------------------------------copy a full year and increment by 1 year for the baseline-------------------------
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
$a$SELECT
|
$a$
|
||||||
|
INSERT INTO
|
||||||
|
fc.live
|
||||||
|
SELECT
|
||||||
$a$||_clist_inc||
|
$a$||_clist_inc||
|
||||||
$b$'forecast' "versoin",
|
$b$
|
||||||
|
'forecast_name' "version",
|
||||||
'baseline' iter
|
'baseline' iter
|
||||||
FROM
|
FROM
|
||||||
baseline
|
baseline
|
||||||
$b$
|
WHERE
|
||||||
|
$b$||_order_date||$c$ + interval '1 year' >= $c$||'[app_first_order_date_year]'
|
||||||
|
--the final forecast baseline should have orders greater than or equal to the
|
||||||
|
--start of the year since new orders is the intended forecast
|
||||||
INTO
|
INTO
|
||||||
_baseline;
|
_baseline;
|
||||||
|
|
||||||
@ -105,7 +112,8 @@ INTO
|
|||||||
------------------------------stack the sql into the final format------------------------------------------------
|
------------------------------stack the sql into the final format------------------------------------------------
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
$$WITH
|
$$DELETE FROM fc.live WHERE version = 'forecast_name';
|
||||||
|
WITH
|
||||||
baseline AS (
|
baseline AS (
|
||||||
$$||_ytdbody||
|
$$||_ytdbody||
|
||||||
$$UNION ALL
|
$$UNION ALL
|
||||||
|
Loading…
Reference in New Issue
Block a user