pós -gres soma de soma Stackoverflow
SELECT sum(CASE event
WHEN 'received' THEN
quantity
WHEN 'sent' THEN
-quantity
ELSE
0
END)
FROM shipments;
Puzzled Puffin