using sum function in mysql for two diffrenet conditions

Solutions on MaxInterview for using sum function in mysql for two diffrenet conditions by the best coders in the world

showing results for - "using sum function in mysql for two diffrenet conditions"
Immy
14 Feb 2020
1
2        
3            
4        
5     SELECT 
6    SUM(CASE
7        WHEN status = 'Shipped' THEN quantityOrdered
8    END) qty_shipped,
9    SUM(CASE
10        WHEN status = 'Resolved' THEN quantityOrdered
11    END) qty_resolved,
12    SUM(CASE
13        WHEN status = 'Cancelled' THEN quantityOrdered
14    END) qty_cancelled,
15    SUM(CASE
16        WHEN status = 'On Hold' THEN quantityOrdered
17    END) qty_on_hold,
18    SUM(CASE
19        WHEN status = 'Disputed' THEN quantityOrdered
20    END) qty_on_disputed,
21    SUM(CASE
22        WHEN status = 'In Process' THEN quantityOrdered
23    END) qty_in_process
24FROM
25    orderdetails
26        INNER JOIN
27    orders USING (orderNumber);
28
Jesús
19 Oct 2018
1SELECT sum( mark ) FROM `student`
queries leading to this page
mysql sum of all the rowsselect sum of all data mysqladd numbers in mysqlsum 28 29 over 28 29 in mysqltotal sum of column in mysqlsum results mysqlhow to sum numbers per member mysqlsum of columns in mysql querymysql sum commandsum of values in column mysqlmysql select up to summysql query total sumhow to sum up amounts in sql table phpsum mysql columnmysql count sumsum query in mysqlsum mysql queryphp how to get sum values for column in table listmysql sum sum havingmyssl sumsum column mysql querymysql sum case when multiple conditionsmysql sum colummysql display as sumsum of rows mysql columnsum some value to mysql columnhow to sum in phpmyadmin using select mysqlihow to sum columns in a mysql table 3bsum of column values mysqlmysql sum 28if multiple conditions 29php sum all values in from databsemysql sum column wheremysql sum whole tablemysql sum of additionhow to calculate the sum in mysql and display it in phpsum total of columns mysqlksum column values mysqlcan i pass sql statement in sum function in mysqlsum column in mysqlmysql sum of column used by as colum namecalculating total amount given by each person in mysqlmysql sum column with conditionmysql calculate totalhow to get the sum in mysqlphp mysql select sum of sumsum query in mysqli including null valuesum of a colum as mysqlwhow to sum a column mysqlmysql sum 28select sum of column in mysqlmysql query to column sumhow to sum variables in mysql with parameters valuephp to sum a column in sqlmysql php sum whereselect total value of two products in my sqlmysql column summysql display sum of columnhow to calculate additions in mysqlmysql multiple column sum in node jsmysql query to take sum a columnmysql where with column using sumsum column mysqlselect sum in mysqlget sum of row mysqlhow to sum outputs mysqlsum 7 column value in mysqlsum if one column in which another column is 10 mysqladd total in sql query phpaddition in mysqlmysql addition functionrow sum sql phpmysql sum column in query resultsum 28 29 in sql with mysqlsum of selected cells in phpsum columinmysqlphp table data sumationsum of multiple if statements mysqlsum of one field in mysqlmysql all results with sum on columnaddition in mysqlmysql add all values of a columnselect one column after sum mysqlprint and sum all rows of data in mysqlsum function mysqlsum a column phpmysql total values of a count 28 2a 29how to details and sums of record in one query in mysqlcretae functio to display total in mysql sb dbmssum in mysqlsum value database mysql statementsum clause in mysqlmysql summysql sum values in columnsum columnsmssqlphp sql sum columnsum of a column of result mysqlmysql totalmysql select total sumselect sum sql phpmysql sum 28 29 ashow to sum rows in mysqlsum of values in a column mysqlmysql select all and sum columnsmysql select sum of all records and with last invoice sumhow to find sum in mysqlsum of column in mysqlcalculate sum of column in mysqlsum of colum msql phpmysql query to get total sum of columnsum row mysqlmysql sum values of a columnsum of a column in mysqlmysql query query sum of columnmysql table sum of columnsum columns then rows mysqlsum qty mysqldifferent sum query in mysqlfind the sum of counts in mysqlmysql sum column valuesselect total value mysqlphp mysql sum columnsselect 2a sum 28 29 in mysql mysql sum functioncalculate sum total of all the figures in a column and save that value into databse phpmysql sum of row valuesmysql sum select columnsum distinct mysqlsum where condition in mysql view tablehow to make summation procedue in mysqlsum rows mysqlmysql select sumsum as query in mysqlsum in my sqlselect all entries and sum the total phpmssql qryt to sum totladisplay sum finction sql value in phpfind the sum of count in mysqlsum a column in mysql table mysql sum of selectget the sum of numbers in colum mysql caculate sum of 1 column in mysqlselect one column from having sum mysqlmysql add all values in columnhow to sum columns in mysql tabletotal number column mysqlhow to sum columns in mysqlhow to sum a cloumn in mysqlmysql sum one columnmysql as column summysql 3a get the sum of each columnmysql total sumsum select in mysqlsum of columns in mysqlget sum of column mysqlmysql table column totalmysql to sum all columnquery sum mysqlsum where mysqlhtml sum mysql columnmysql total columnmysql easy way to sum 2b 1 on int columnmysql show the sum by itemmysql sumar columnmysql sum column by sum of first 25 rows mysqlhow to echo sum function in query in mysqlsum of values in a row mysqlmysql select sum of all records by bill idselect ids having sum mysqlhow to sum sales amouts mysqlmysql calculate summysql add total row in phpmyadminhow to sum columns from two views in mysqlsum of selected column in mysqlmysql sum all rows valuehow to get the sum of all column in a single query phpmysql select up to totalmysql sum rowsum with conditions mysqlsearch sum mysqlmysql sum function when using row ordermysql sum of different columnssum of column values in mysqlsum from select mysqlsum values mysqlmysql sum rowssummarize table mysql commandsum 28 29 in mysqlhow to sum row values in mysqlsum of all numbers in column in mysqlmysql sum linesmysql select sum wheresumming number values in mysql databasesum utwo columns in mysqlsum in select statementselect sum mysqlmysql sum as columnget the sum of a column mysqlmysql calculate sum of columnsum mysql column valueget total amount in mysqlmysql sum of columnssum of column mysqlsum same row value mysqlmysql query sum of column phpsum 28 2a 29 over 28 29 in mysqlmysql addition in select querymysql sum all columnsadd sum field to mysql tablesum sql in phphow to do all column sum in mysqlsearch sum mysql equals group bymysql sum of amountover all select sum in mysqlmysql sum function get more rowsdisplay sum of mysql rowmysql suma valuehow to get the sum of a column in mysqlwrite the value of my sql sum to columncal sum of columns in mysqlmysql total value in columnsum mysqlhow to sum in phpmyadmin using select wquerymysql sum with wherephp sum amount field in dbmysql query for sum of columnphp mysql select sum of columnsearch sum mysql equalsmysql sum of values in a columnmy sql summysql total of columnhow to calculate total in mysqlmysql where sum of columnscolumns sum in mysqlget sum of value mysqlphp code to sum sales data column and row in mysql databasemysql row of total of sumphp add sum of values in a databsesum 3 sums myysqlmysql get sum columnmysql two tables sum return separatelyhow to do a php select sumsum by 2 columns in mysqlwhere sum 28column 29 mysqlhow to sum mysql columnmysql sum of column wherehow to calculate 25 of total in mysqlhow to sum all the values in a column in mysqlmy sql display the sum of columnhow to add numbers in mysqlphp table colum data sumationget sum of a column in mysqlselet sum mtsqlhow to operate addition of elements in databasemysql sum function exampleselect sum as mysqlmysql php sum where betweenmysql sum ifsum of rows values in mysqlsum statement mysqlsql query to sum close to given amount mysqlsum of colum mssql phpmysql query sum valuemysql sum querymysql sum columnsmysql query to get sum of columntotal of a field mysqlsum of query in mysqlsum function in mysqlsum mysql distinctmysql get result sum columnmysql collumn addition exoressionselect sum phpsum a column mysqlmysql sum of columnmysql sum distinctsum column in mysql querymysql query select sum 3dsmysql sumsum to null column in mysqlhow to use format 28sum 29 2c20 and case in mysql queryget sum columns mysqlwhat we call sum in mysqlmysql query to sum a columnhow to handle sum value as null mysqlhow to sum numbers in database in phpmysql sum allhow to sum a column in mysqlmysql use result of sumtotal mysqlhow to sum data into mysql tablesum fuction in mysqltking database values summysql sumar columnaget the sum of column in mysqlsum database row phpselect sum of column mysqlwhere to find column amount in mysqlusing sum function in mysql for two diffrenet conditionssum and 22 2b 22 in mysqlsort the sum cases nin mysql querymysql summary fieldssum in mysql command for column valuesmysql additionselect sum of rows mysqlmysql sum wheremysql select sum of columnmysql addition columnhow to sum all the data of colum i myswlmysql sum columnsum of all columns mysqlmysql query total sum of each columnmy sql sum of values through joined tablesum values database php mysqlmsql additionsum column and select name mysqlmake total on query mysqlfind total in mysqlphp sum column valuephp query 28 27select sum 28balance 29 mysql custom column as sumhow to return column sum in phpmysql sum asseleect sum mysqlmysql how to sum column valuemysql select sum columnmysql sum 1 to columnselect sum selects mysqlphp 2c mysql summysql sum with multiple conditionget sum of column in mysqlfind sum of a column value in my sqlmysql query sum of columnmysql where on sum columnsum with distinct mysqlmysql addition of valuessum of all columns in mysqlcalculating the sum of a column based on a condition in mysqlsql sum column mysqldo an addition in mysqlsum mysql column valuessum same row mysqlget sum mysqlmysql sum on selectmysql sum of column liimtmysql sum column in resultusing sum function in mysql for two diffrenet conditions