snap item master attributes
This commit is contained in:
parent
c6df2774cb
commit
b9ff9c1493
63
build/snap_itemm_pool.sql
Normal file
63
build/snap_itemm_pool.sql
Normal file
@ -0,0 +1,63 @@
|
||||
BEGIN;
|
||||
|
||||
WITH
|
||||
SEG AS (
|
||||
SELECT
|
||||
GLEC
|
||||
,SEGM
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1CU','Retail'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
('2WI','Greenhouse'),
|
||||
('3BM','Other'),
|
||||
('3CO','Other'),
|
||||
('3PE','Other'),
|
||||
('3PP','Other'),
|
||||
('4CO','Other'),
|
||||
('4RA','Other'),
|
||||
('9MI','Other'),
|
||||
('9SA','Other'),
|
||||
('9TO','Other')
|
||||
) X(GLEC, SEGM)
|
||||
)
|
||||
,fin AS (
|
||||
SELECT DISTINCT
|
||||
o.part
|
||||
,i.item||coalesce(' - '||i.descr,'') part_descr
|
||||
,i.stlc part_group
|
||||
,i.branding
|
||||
,i.majg||' - '||i.majgd majg_descr
|
||||
,i.ming||' - '||i.mingd ming_descr
|
||||
,i.majs||' - '||i.majsd majs_descr
|
||||
,i.mins||' - '||i.minsd mins_descr
|
||||
,seg.segm
|
||||
,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
|
||||
FROM
|
||||
rlarp.osm_pool o
|
||||
LEFT OUTER JOIN rlarp.itemm i ON
|
||||
i.item = o.part
|
||||
LEFT OUTER JOIN seg ON
|
||||
seg.glec = i.glec
|
||||
)
|
||||
UPDATE
|
||||
rlarp.osm_pool o
|
||||
SET
|
||||
part_descr = fin.part_descr
|
||||
,part_group = fin.part_group
|
||||
,branding = fin.branding
|
||||
,majg_descr = fin.majg_descr
|
||||
,ming_descr = fin.ming_descr
|
||||
,majs_descr = fin.majs_descr
|
||||
,mins_descr = fin.mins_descr
|
||||
,segm = fin.segm
|
||||
,substance = fin.substance
|
||||
FROM
|
||||
fin
|
||||
WHERE
|
||||
fin.part = o.part;
|
||||
|
||||
COMMIT;
|
Loading…
Reference in New Issue
Block a user