From e4054326d037bd40c169aa0466feb2277608cfea Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 5 Apr 2021 12:36:51 -0400 Subject: [PATCH] increment scenario selector --- route_sql/scenario_package.sql | 36 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/route_sql/scenario_package.sql b/route_sql/scenario_package.sql index b1d68d4..c6dddde 100644 --- a/route_sql/scenario_package.sql +++ b/route_sql/scenario_package.sql @@ -36,7 +36,7 @@ FROM rlarp.osm_pool WHERE where_clause - AND order_season IN (2020,2021) + AND order_season IN (2021,2022) GROUP BY order_season ,order_month @@ -94,14 +94,14 @@ GROUP BY SELECT order_month ,seq - ,SUM(units) FILTER (WHERE order_season = 2020) "2020 qty" - ,SUM(units) FILTER (WHERE order_season = 2021 AND iter IN ('copy','short ship','bad_ship')) "2021 base qty" - ,SUM(units) FILTER (WHERE order_season = 2021 AND iter NOT IN ('copy','short ship','bad_ship')) "2021 adj qty" - ,SUM(units) FILTER (WHERE order_season = 2021) "2021 tot qty" - ,SUM(value_usd) FILTER (WHERE order_season = 2020) "2020 value_usd" - ,SUM(value_usd) FILTER (WHERE order_season = 2021 AND iter IN ('copy','short ship','bad_ship')) "2021 base value_usd" - ,SUM(value_usd) FILTER (WHERE order_season = 2021 AND iter NOT IN ('copy','short ship','bad_ship')) "2021 adj value_usd" - ,SUM(value_usd) FILTER (WHERE order_season = 2021) "2021 tot value_usd" + ,SUM(units) FILTER (WHERE order_season = 2021) "2021 qty" + ,SUM(units) FILTER (WHERE order_season = 2022 AND iter IN ('copy','short ship','bad_ship')) "2022 base qty" + ,SUM(units) FILTER (WHERE order_season = 2022 AND iter NOT IN ('copy','short ship','bad_ship')) "2022 adj qty" + ,SUM(units) FILTER (WHERE order_season = 2022) "2022 tot qty" + ,SUM(value_usd) FILTER (WHERE order_season = 2021) "2021 value_usd" + ,SUM(value_usd) FILTER (WHERE order_season = 2022 AND iter IN ('copy','short ship','bad_ship')) "2022 base value_usd" + ,SUM(value_usd) FILTER (WHERE order_season = 2022 AND iter NOT IN ('copy','short ship','bad_ship')) "2022 adj value_usd" + ,SUM(value_usd) FILTER (WHERE order_season = 2022) "2022 tot value_usd" FROM months GROUP BY @@ -113,14 +113,14 @@ GROUP BY ,mlist AS ( SELECT mseq.m order_month - ,"2020 qty" - ,"2021 base qty" - ,"2021 adj qty" - ,"2021 tot qty" - ,"2020 value_usd" - ,"2021 base value_usd" - ,"2021 adj value_usd" - ,"2021 tot value_usd" + ,"2021 qty" + ,"2022 base qty" + ,"2022 adj qty" + ,"2022 tot qty" + ,"2021 value_usd" + ,"2022 base value_usd" + ,"2022 adj value_usd" + ,"2022 tot value_usd" FROM mseq LEFT OUTER JOIN mpvt ON @@ -182,4 +182,4 @@ SELECT ,(SELECT jsonb_agg(tag) FROM tags) ,'customers' ,(SELECT jsonb_agg(row_to_json(custs)::jsonb) FROM custs) - ) package \ No newline at end of file + ) package