isolate short an over shipments

This commit is contained in:
Paul Trowbridge 2021-04-13 16:01:00 -04:00
parent 7e4049d27d
commit 94ae5e192c

15
over_under_ship.sql Normal file
View 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;