Compare commits
2 Commits
a6bfd7c8e0
...
4baa1c7382
Author | SHA1 | Date | |
---|---|---|---|
4baa1c7382 | |||
ea4d8213d4 |
@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
|
|||||||
o.customer
|
o.customer
|
||||||
,o.chanwide
|
,o.chanwide
|
||||||
,o.nursery_region
|
,o.nursery_region
|
||||||
,o.general_region
|
,c.greenhouse_region
|
||||||
,m.part_group baseitem
|
,m.part_group baseitem
|
||||||
,m.majg
|
,m.majg
|
||||||
,m.assc
|
,m.assc
|
||||||
@ -46,6 +46,8 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
|
|||||||
AND tq.mold = i.stlc
|
AND tq.mold = i.stlc
|
||||||
AND tq.chan = 'DISTRIB DROP SHIP'
|
AND tq.chan = 'DISTRIB DROP SHIP'
|
||||||
AND tq.data_segment = _ds.dataseg
|
AND tq.data_segment = _ds.dataseg
|
||||||
|
LEFT OUTER JOIN rlarp.cust c ON
|
||||||
|
c.code = CASE o.chan WHEN 'DIR' THEN o.bill_cust ELSE o.ship_cust END
|
||||||
WHERE
|
WHERE
|
||||||
o.version <> '6/1 Order Book'
|
o.version <> '6/1 Order Book'
|
||||||
--AND o.part like 'SQL035%'
|
--AND o.part like 'SQL035%'
|
||||||
@ -57,7 +59,7 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
|
|||||||
o.customer
|
o.customer
|
||||||
,o.chanwide
|
,o.chanwide
|
||||||
,o.nursery_region
|
,o.nursery_region
|
||||||
,o.general_region
|
,c.greenhouse_region
|
||||||
,m.part_group
|
,m.part_group
|
||||||
,m.majg
|
,m.majg
|
||||||
,m.assc
|
,m.assc
|
||||||
@ -76,11 +78,10 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
|
|||||||
'customer' ,CASE WHEN GROUPING(customer ) = 0 THEN customer END
|
'customer' ,CASE WHEN GROUPING(customer ) = 0 THEN customer END
|
||||||
,'chanwide' ,CASE WHEN GROUPING(chanwide ) = 0 THEN chanwide END
|
,'chanwide' ,CASE WHEN GROUPING(chanwide ) = 0 THEN chanwide END
|
||||||
,'nursery_region' ,CASE WHEN GROUPING(nursery_region ) = 0 THEN nursery_region END
|
,'nursery_region' ,CASE WHEN GROUPING(nursery_region ) = 0 THEN nursery_region END
|
||||||
,'general_region' ,CASE WHEN GROUPING(general_region ) = 0 THEN general_region END
|
,'greenhouse_region' ,CASE WHEN GROUPING(greenhouse_region ) = 0 THEN greenhouse_region END
|
||||||
--,'country' ,CASE WHEN GROUPING(country) = 0 THEN country END
|
|
||||||
,'baseitem' ,CASE WHEN GROUPING(baseitem ) = 0 THEN baseitem END
|
,'baseitem' ,CASE WHEN GROUPING(baseitem ) = 0 THEN baseitem END
|
||||||
,'v1dataseg' ,CASE WHEN GROUPING(v1dataseg) = 0 THEN v1dataseg END
|
,'v1dataseg' ,CASE WHEN GROUPING(v1dataseg ) = 0 THEN v1dataseg END
|
||||||
,'v0dataseg' ,CASE WHEN GROUPING(v0dataseg) = 0 THEN v0dataseg END
|
,'v0dataseg' ,CASE WHEN GROUPING(v0dataseg ) = 0 THEN v0dataseg END
|
||||||
)
|
)
|
||||||
) gset
|
) gset
|
||||||
,oseas
|
,oseas
|
||||||
@ -93,14 +94,14 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
|
|||||||
agg
|
agg
|
||||||
GROUP BY GROUPING SETS (
|
GROUP BY GROUPING SETS (
|
||||||
-- oseas baseitem v0datseg chanwide customer region v1dataseg --
|
-- oseas baseitem v0datseg chanwide customer region v1dataseg --
|
||||||
(oseas, baseitem, v0dataseg, customer )
|
(oseas, baseitem, chanwide, v0dataseg, customer )
|
||||||
,(oseas, baseitem, customer, v1dataseg )
|
,(oseas, baseitem, chanwide, customer, v1dataseg )
|
||||||
,(oseas, baseitem, v0dataseg, chanwide )
|
,(oseas, baseitem, chanwide, v0dataseg )
|
||||||
,(oseas, baseitem, v0dataseg, chanwide, nursery_region )
|
,(oseas, baseitem, chanwide, v0dataseg, nursery_region )
|
||||||
,(oseas, baseitem, v0dataseg, chanwide, general_region )
|
,(oseas, baseitem, chanwide, v0dataseg, greenhouse_region )
|
||||||
,(oseas, baseitem, chanwide, v1dataseg )
|
,(oseas, baseitem, chanwide, v1dataseg )
|
||||||
,(oseas, baseitem, v0dataseg, nursery_region )
|
,(oseas, baseitem, chanwide, v0dataseg, nursery_region )
|
||||||
,(oseas, baseitem, v0dataseg, general_region )
|
,(oseas, baseitem, chanwide, v0dataseg, greenhouse_region )
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
@ -129,7 +130,7 @@ CREATE TABLE IF NOT EXISTS rlarp.price_pool_dev AS (
|
|||||||
-- rlarp.price_pool g
|
-- rlarp.price_pool g
|
||||||
--WHERE
|
--WHERE
|
||||||
-- o.version IN ('Actual','Quotes')
|
-- o.version IN ('Actual','Quotes')
|
||||||
-- AND g.gset = jsonb_build_object('baseitem',o.baseitem,'v0dataseg',o.v0dataseg,'chanwide','D','general_region','US');
|
-- AND g.gset = jsonb_build_object('baseitem',o.baseitem,'v0dataseg',o.v0dataseg,'chanwide','D','greenhouse_region','US');
|
||||||
--
|
--
|
||||||
--UPDATE
|
--UPDATE
|
||||||
-- rlarp.osm_stack o
|
-- rlarp.osm_stack o
|
||||||
|
Loading…
Reference in New Issue
Block a user