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
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
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us