Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

postgresql sum

SELECT SUM(amount) FROM account;
Comment

PREVIOUS NEXT
Code Example
Sql :: SQL Switch Databases 
Sql :: mysql allow connection from any host 
Sql :: what does leave do in mysql 
Sql :: query only first letter string 
Sql :: sql to excel pgadmin 
Sql :: sqlite3 python foreign key 
Sql :: foreign key sql 
Sql :: sql server get number of working days in a month 
Sql :: sql developer connect to sql server 
Sql :: sql order by clause 
Sql :: sqlite trim 
Sql :: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , , = or when the subquery is used as an expression. 
Sql :: SQL SMALLDATETIME Data Type 
Sql :: sql case sttement with set 
Sql :: postgres enumerated type 
Sql :: Insert Multiple Rows at Once in SQL 
Sql :: selecting all columns from table sql database 
Sql :: doctors appointment 
Sql :: sql count * vs count 1 
Sql :: with transaction.atomic(): 
Sql :: Example SQL Test 
Sql :: postgres add foreign key to existing table 
Sql :: recourse record format 
Sql :: System.Diagnostics.Process is not supported on this platform 
Sql :: sql commands in android 
Sql :: sysdatetimeoffset 
Sql :: storing RGBA in mysql db 
Sql :: oracle call a function in a insert statement 
Sql :: veri girme SQL 
Sql :: postgresql not in alternative 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =