Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Sql :: restart identity cascade 
Sql :: sql server delete row 
Sql :: console output pl sql 
Sql :: psql count where not null 
Sql :: delete triger pl pg sql 
Sql :: sql beginning of previous month 
Sql :: liquibase update row 
Sql :: convert float to int sql 
Sql :: query any digits record 
Sql :: mysql change root password ubuntu 
Sql :: oracle list datafiles in tablespace 
Sql :: table infromation in sql server 
Sql :: python how to connect to sql server 
Sql :: How to select the nth row in a SQL database table? 
Sql :: mysqldump csv 
Sql :: mysql breakline on string 
Sql :: postgres get database encoding 
Sql :: convert uniqueidentifier to varchar in sql 
Sql :: ALL_TAB_PARTITIONS 
Sql :: postgresql add alter permissions to role 
Sql :: show all users in mysql 
Sql :: sql query length of string the longest 
Sql :: inner join php my admin 
Sql :: add timestamp column to existing table ms sql server 
Sql :: oracle list of long running queries 
Sql :: select count of distinct values sql 
Sql :: oracle asynchronous procedure 
Sql :: data types sql 
Sql :: alter table name 
Sql :: How to get todays date and current time in mysql 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =