parition by mxm since there is s cross join
This commit is contained in:
parent
2fc146ae5d
commit
22605092bb
@ -323,6 +323,7 @@ SELECT
|
||||
,quota_rep_descr
|
||||
,director_descr
|
||||
)
|
||||
,applyx AS (
|
||||
SELECT
|
||||
b.plnt --master data
|
||||
,b."ddord#"
|
||||
@ -384,11 +385,11 @@ SELECT
|
||||
,b.ddqtsi
|
||||
,b.fgqshp
|
||||
,b.diqtsh
|
||||
,b.fb_qty
|
||||
,(b.agg/sum(b.agg) OVER (partition by mxm.*))*mxm.momix*mxm.qty fb_qty
|
||||
,b.fb_cst_loc
|
||||
,b.fb_cst_loc_cur
|
||||
,b.fb_cst_loc_fut
|
||||
,b.fb_val_loc
|
||||
,(b.agg/sum(b.agg) OVER (partition by mxm.*))*mxm.momix*mxm.amount fb_val_loc
|
||||
,b.fb_val_loc_pl
|
||||
,b.calc_status
|
||||
,b.flag
|
||||
@ -432,6 +433,8 @@ SELECT
|
||||
,b.cost_loc
|
||||
,b.cost_usd
|
||||
,b.units
|
||||
,(b.agg/sum(b.agg) OVER (partition by mxm.*)) bmix
|
||||
,mxm.*
|
||||
FROM
|
||||
basemix b
|
||||
CROSS JOIN mxm
|
||||
@ -441,3 +444,5 @@ FROM
|
||||
make_date(mxm.yr + 2020,mxm.cal,mxm.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
||||
LEFT OUTER JOIN gld sd ON
|
||||
make_date(mxm.yr + 2020,mxm.cal,mxm.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
||||
)
|
||||
SELECT * from applyx
|
Loading…
Reference in New Issue
Block a user