SUM(CASE WHEN column = value THEN column END) alias
eg
SUM(CASE WHEN car.brand = 'Toyota' THEN sales END) toyota_sales
SELECT SUM(amount) FROM account;
Code Example |
---|
Sql :: ms sql server port |
Sql :: add clumn to table postgres |
Sql :: for select oracle |
Sql :: try catch sql |
Sql :: sql inserted |
Sql :: insert into table from another table |
Sql :: uninstall mysql ubuntu 18.04 stackoverflow |
Sql :: if null put 0 sql |
Sql :: update select mysql |
Sql :: mysql for windows 10 64 bit |
Sql :: like in postgresql |
Sql :: how to connect to postgres |
Sql :: oracle ddl |
Sql :: insert query mysql workbench |
Sql :: mysql in |
Sql :: sql create table |
Sql :: identity syntax in sql |
Sql :: how to delete database in mysql |
Sql :: insert in sql |
Sql :: SQL SELECT TOP Equivalent in MySQL |
Sql :: sql group by example |
Sql :: list foreign key oracle |
Sql :: mysql last friday of current month |
Sql :: replace content value from old to new sql |
Sql :: sql check if table exists |
Sql :: between date in sql server |
Sql :: sql add calculated column |
Sql :: sql create cluster index |
Sql :: frename oracle |
Sql :: sql foreign key constraint |