commit
14ed4a95fe
@ -23,7 +23,8 @@ repc AS (
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1CU','Retail'),
|
||||
('1SU','Sustainable'),
|
||||
('1CU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
|
@ -8,7 +8,8 @@ SEG AS (
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1CU','Retail'),
|
||||
('1SU','Sustainable'),
|
||||
('1CU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
|
15
over_under_ship.sql
Normal file
15
over_under_ship.sql
Normal file
@ -0,0 +1,15 @@
|
||||
SELECT
|
||||
calc_status,
|
||||
flag,
|
||||
sum(fb_val_loc * r_rate) filter (where fb_qty < 0) overship,
|
||||
sum(fb_val_loc * r_rate) filter (where fb_qty > 0) undership
|
||||
FROM
|
||||
rlarp.osm_dev
|
||||
WHERE
|
||||
oseas = 2021
|
||||
AND version = 'ACTUALS'
|
||||
AND calc_status = 'CLOSED'
|
||||
AND flag = 'REMAINDER'
|
||||
GROUP BY
|
||||
calc_status,
|
||||
flag;
|
@ -53,7 +53,8 @@ target AS (select $$replace_request$$::json def)
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1CU','Retail'),
|
||||
('1SU','Sustainable'),
|
||||
('1CU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
|
@ -37,7 +37,8 @@ target AS (SELECT $$swap_doc$$::jsonb swap)
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1CU','Retail'),
|
||||
('1SU','Sustainable'),
|
||||
('1CU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
|
@ -2,7 +2,11 @@ WITH
|
||||
target AS (SELECT $$swap_doc$$::jsonb swap)
|
||||
,pl AS (
|
||||
SELECT
|
||||
x.*
|
||||
-----trim white space on CMS part numbers coming from spreadsheet master data----
|
||||
rtrim(x.original) AS original
|
||||
,sales
|
||||
,rtrim(x."replace") AS replace
|
||||
,rtrim(x.fit) fit
|
||||
FROM
|
||||
TARGET
|
||||
LEFT JOIN LATERAL jsonb_to_recordset(target.swap->'rows') AS x(original text, sales numeric, replace text, fit text)ON TRUE
|
||||
@ -17,7 +21,8 @@ target AS (SELECT $$swap_doc$$::jsonb swap)
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1CU','Retail'),
|
||||
('1CU','Sustainable'),
|
||||
('1SU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
|
Loading…
Reference in New Issue
Block a user