forecast_api/inquirey/tots.sql

67 lines
1.7 KiB
MySQL
Raw Permalink Normal View History

2020-04-07 14:53:53 -04:00
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,
2021-07-09 00:54:44 -04:00
sum(fb_val_loc * r_rate) value_loc
2020-04-07 14:53:53 -04:00
FROM
2021-07-06 09:33:58 -04:00
rlarp.osmf_dev o
2021-07-09 00:54:44 -04:00
WHERE
fs_line = '41010'
and calc_status <> 'CANCELED'
2020-04-07 14:53:53 -04:00
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
2021-07-12 15:35:15 -04:00
--------------------------------------------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