Switch source table from rlarp.itemmv to "CMS.CUSLG".itemm
This commit is contained in:
parent
59cb926d9c
commit
ed5975daf7
@ -1,3 +1,4 @@
|
||||
-- Connection: usmidsap01.ubm
|
||||
--\timing
|
||||
TRUNCATE TABLE rlarp.osmf;
|
||||
|
||||
|
@ -39,7 +39,7 @@ SELECT DISTINCT
|
||||
,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
LEFT OUTER JOIN rlarp.itemmv i ON
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemmv i ON
|
||||
i.item = o.part
|
||||
LEFT OUTER JOIN seg ON
|
||||
seg.glec = i.glec
|
||||
|
@ -154,7 +154,7 @@ incr AS (
|
||||
,row_number() OVER (PARTITION BY o.styc||'.'||o.colgrp||substring(o.sizc,1,3),o.account, o.shipgrp ORDER BY o.odate DESC) rn
|
||||
FROM
|
||||
rlarp.osm_dev o
|
||||
INNER JOIN rlarp.itemmv i ON
|
||||
INNER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
---exclude R&A's
|
||||
@ -226,7 +226,7 @@ SELECT
|
||||
,jsonb_agg(DISTINCT iter) iters
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
,rlarp.itemmv i
|
||||
,"CMS.CUSLG".itemm i
|
||||
WHERE
|
||||
i.item = o.part
|
||||
--AND o.units <> 0
|
||||
@ -415,7 +415,7 @@ GROUP BY
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
--need to join to itemm to get the product from osm_pool
|
||||
,rlarp.itemmv i
|
||||
,"CMS.CUSLG".itemm i
|
||||
WHERE
|
||||
i.item = o.part
|
||||
GROUP BY
|
||||
|
@ -354,7 +354,7 @@ SELECT
|
||||
FROM
|
||||
basemix b
|
||||
CROSS JOIN log
|
||||
LEFT OUTER JOIN rlarp.itemmv i ON
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = b.part
|
||||
LEFT OUTER JOIN SEG ON
|
||||
SEG.GLEC = i.glec
|
||||
|
@ -11,7 +11,7 @@ target AS (select 'replace_new_mold' new_mold)
|
||||
SUM(value_usd) value_usd
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
LEFT OUTER JOIN rlarp.itemmv i ON
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.item = o.part
|
||||
WHERE
|
||||
-----------------scenario----------------------------
|
||||
@ -46,7 +46,7 @@ target AS (select 'replace_new_mold' new_mold)
|
||||
CASE WHEN substring(b.part,9,12) = substring(i.item,9,12) THEN '1' ELSE 0 END fit
|
||||
FROM
|
||||
basemix b
|
||||
LEFT OUTER JOIN rlarp.itemmv i ON
|
||||
LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
|
||||
i.stlc = (SELECT new_mold FROM target WHERE new_mold <> '')
|
||||
AND CASE WHEN b.sizc = i.sizc THEN '1' ELSE '0' END||
|
||||
CASE WHEN i.aplnt = 'I' THEN '0' ELSE '1' END||
|
||||
|
@ -160,13 +160,13 @@ target AS (SELECT $$swap_doc$$::jsonb swap)
|
||||
remove o
|
||||
INNER JOIN pl ON
|
||||
pl.original = o.part
|
||||
INNER JOIN rlarp.itemmv m ON
|
||||
INNER JOIN "CMS.CUSLG".itemm m ON
|
||||
m.item = pl.replace
|
||||
LEFT OUTER JOIN rlarp.icstx c ON
|
||||
c.part = pl.replace
|
||||
AND c.plnt = m.dplt
|
||||
LEFT OUTER JOIN rlarp.plpr r ON
|
||||
yaplnt = m.dplt
|
||||
r.plnt = m.dplt
|
||||
LEFT OUTER JOIN rlarp.ffcret x ON
|
||||
x.fcur = r.curr
|
||||
AND x.tcur = 'US'
|
||||
|
Loading…
Reference in New Issue
Block a user