forecast_api/inquirey/pool_months.sql

18 lines
807 B
MySQL
Raw Permalink Normal View History

2021-07-14 15:44:47 -04:00
SELECT
order_month
,SUM(value_usd) FILTER (WHERE order_season = 2021 AND iter = 'plan') plan2021
,SUM(value_usd) FILTER (WHERE order_season = 2022 AND iter = 'plan') plan2022
,SUM(value_usd) FILTER (WHERE order_season = 2021 AND iter = 'diff') diff2021
,SUM(value_usd) FILTER (WHERE order_season = 2021 AND iter = 'diff') diff2021
,SUM(value_usd) FILTER (WHERE order_season = 2022 AND iter = 'pf') pf2022
,SUM(value_usd) FILTER (WHERE order_season = 2022 AND iter = 'pf') pf2022
,SUM(value_usd) FILTER (WHERE order_season = 2021 AND iter = 'actuals') act2021
,SUM(value_usd) FILTER (WHERE order_season = 2022 AND iter = 'actuals') act2022
FROM
rlarp.osm_pool
WHERE
order_season IN (2021,2022)
--AND quota_rep_descr = 'COLIN MAXWELL'
GROUP BY
order_month