Compare commits

..

No commits in common. "4baa1c738298bdf45b0a94959f0561db16355674" and "a6bfd7c8e03a1c942c0de1bd7f9a9ecb010842be" have entirely different histories.

2 changed files with 19 additions and 22 deletions

View File

@ -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
,c.greenhouse_region ,o.general_region
,m.part_group baseitem ,m.part_group baseitem
,m.majg ,m.majg
,m.assc ,m.assc
@ -46,8 +46,6 @@ 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%'
@ -59,7 +57,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
,c.greenhouse_region ,o.general_region
,m.part_group ,m.part_group
,m.majg ,m.majg
,m.assc ,m.assc
@ -78,7 +76,8 @@ 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
,'greenhouse_region' ,CASE WHEN GROUPING(greenhouse_region ) = 0 THEN greenhouse_region END ,'general_region' ,CASE WHEN GROUPING(general_region ) = 0 THEN general_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
@ -94,14 +93,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, chanwide, v0dataseg, customer ) (oseas, baseitem, v0dataseg, customer )
,(oseas, baseitem, chanwide, customer, v1dataseg ) ,(oseas, baseitem, customer, v1dataseg )
,(oseas, baseitem, chanwide, v0dataseg ) ,(oseas, baseitem, v0dataseg, chanwide )
,(oseas, baseitem, chanwide, v0dataseg, nursery_region ) ,(oseas, baseitem, v0dataseg, chanwide, nursery_region )
,(oseas, baseitem, chanwide, v0dataseg, greenhouse_region ) ,(oseas, baseitem, v0dataseg, chanwide, general_region )
,(oseas, baseitem, chanwide, v1dataseg ) ,(oseas, baseitem, chanwide, v1dataseg )
,(oseas, baseitem, chanwide, v0dataseg, nursery_region ) ,(oseas, baseitem, v0dataseg, nursery_region )
,(oseas, baseitem, chanwide, v0dataseg, greenhouse_region ) ,(oseas, baseitem, v0dataseg, general_region )
) )
) )
SELECT SELECT
@ -130,7 +129,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','greenhouse_region','US'); -- AND g.gset = jsonb_build_object('baseitem',o.baseitem,'v0dataseg',o.v0dataseg,'chanwide','D','general_region','US');
-- --
--UPDATE --UPDATE
-- rlarp.osm_stack o -- rlarp.osm_stack o

View File

@ -1,2 +0,0 @@
- [ ] label aggregation levels with a sort and a short label
- [ ] unwrap the data to the necessary level to get back to a table