From 17265d0b36b9e375e3486bb6bec40c77234bb7e6 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Tue, 7 Apr 2020 14:53:53 -0400 Subject: [PATCH] add totals queries for tie-outs --- build/tots.sql | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ tots.sql | 16 ------------- 2 files changed, 63 insertions(+), 16 deletions(-) create mode 100644 build/tots.sql delete mode 100644 tots.sql diff --git a/build/tots.sql b/build/tots.sql new file mode 100644 index 0000000..4300e0c --- /dev/null +++ b/build/tots.sql @@ -0,0 +1,63 @@ +SELECT + oseas, + to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') order_month, + version, + iter, + sum(fb_val_loc) value_loc +FROM + rlarp.osmfs_dev o +GROUP BY + oseas, + to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon'), + version, + iter +ORDER BY + oseas asc, + order_month asc + + +------------------------------------------short ships------------------------------------- +SELECT + version, + iter, + oseas, + SUM(FB_VAL_LOC::numeric *r_rate::Numeric) +FROM + RLARP.osmf_dev +WHERE + --oseas = 2020 + fs_line = '41010' + --AND odate < '2020-04-01' + AND CALC_STATUS <> 'CANCELED' + AND NOT (calc_status = 'CLOSED' AND flag = 'REMAINDER') +GROUP BY + version, + iter, + oseas + + select distinct version from rlarp.osm_pool + + + + +SELECT + oseas, + to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') order_month, + r_currency, + r_rate, + sum(fb_val_loc) value_loc +FROM + rlarp.osmf_dev o +WHERE + oseas >= 2020 + --AND fs_line = '41010' + --AND odate < '2020-04-01' +GROUP BY + oseas, + to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon'), + r_currency, + r_rate + --glec +ORDER BY + oseas asc, + order_month asc diff --git a/tots.sql b/tots.sql deleted file mode 100644 index fa0d17c..0000000 --- a/tots.sql +++ /dev/null @@ -1,16 +0,0 @@ -SELECT - oseas, - to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') order_month, - version, - iter, - sum(fb_val_loc) value_loc -FROM - rlarp.osmfs_dev o -GROUP BY - oseas, - to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon'), - version, - iter -ORDER BY - oseas asc, - order_month asc