Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

postgres sum substract stackoverflow

SELECT sum(CASE event
             WHEN 'received' THEN
               quantity
             WHEN 'sent' THEN
               -quantity
             ELSE
               0
           END)
       FROM shipments;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #postgres #sum #substract #stackoverflow
ADD COMMENT
Topic
Name
2+6 =