Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql sum if

/* Count the number of ColumnA lines where ColumnB is above 10 */
SELECT COLUMNA
	 , SUM(CASE WHEN COLUMNB > 10 THEN 1 ELSE 0 END) AS COUNT_ABOVE_TEN
FROM TABLEA
GROUP BY COLUMNA
 
PREVIOUS NEXT
Tagged: #sql #sum
ADD COMMENT
Topic
Name
3+4 =