16 lines
343 B
SQL
16 lines
343 B
SQL
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;
|