change target name, and exlude gld joins intended for snapping months, that should be done during data prep
This commit is contained in:
parent
5134b659c0
commit
a8419e9fd6
@ -8,16 +8,10 @@ baseline AS (
|
|||||||
,'actuals' iter
|
,'actuals' iter
|
||||||
FROM
|
FROM
|
||||||
rlarp.osm_dev o
|
rlarp.osm_dev o
|
||||||
--snap the ship dates of the historic fiscal period
|
|
||||||
LEFT OUTER JOIN gld ON
|
|
||||||
gld.fspr = o.fspr
|
|
||||||
--get the shipping season for open orders based on the snapped date
|
|
||||||
LEFT OUTER JOIN gld ss ON
|
|
||||||
greatest(least(o.sdate,gld.edat),gld.sdat) BETWEEN ss.sdat AND ss.edat
|
|
||||||
WHERE
|
WHERE
|
||||||
(
|
(
|
||||||
--base period orders booked....
|
--base period orders booked....
|
||||||
[target_odate] BETWEEN [target_odate_from] AND [target_odate_to]
|
[order_field_name] BETWEEN [target_odate_from] AND [target_odate_to]
|
||||||
--...or any open orders currently booked before cutoff....
|
--...or any open orders currently booked before cutoff....
|
||||||
OR ([status_flag] IN ([status_list]) and [target_date] <= [target_date_from])
|
OR ([status_flag] IN ([status_list]) and [target_date] <= [target_date_from])
|
||||||
--...or anything that shipped in that period
|
--...or anything that shipped in that period
|
||||||
|
Loading…
Reference in New Issue
Block a user