Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

postgres sum when

SUM(CASE WHEN column = value THEN column END) alias

eg

SUM(CASE WHEN car.brand = 'Toyota' THEN sales END) toyota_sales
 
PREVIOUS NEXT
Tagged: #postgres #sum
ADD COMMENT
Topic
Name
7+5 =