Answers for "using sum function in mysql for two diffrenet conditions"

SQL
1

using sum function in mysql for two diffrenet conditions

SELECT 
    SUM(CASE
        WHEN status = 'Shipped' THEN quantityOrdered
    END) qty_shipped,
    SUM(CASE
        WHEN status = 'Resolved' THEN quantityOrdered
    END) qty_resolved,
    SUM(CASE
        WHEN status = 'Cancelled' THEN quantityOrdered
    END) qty_cancelled,
    SUM(CASE
        WHEN status = 'On Hold' THEN quantityOrdered
    END) qty_on_hold,
    SUM(CASE
        WHEN status = 'Disputed' THEN quantityOrdered
    END) qty_on_disputed,
    SUM(CASE
        WHEN status = 'In Process' THEN quantityOrdered
    END) qty_in_process
FROM
    orderdetails
        INNER JOIN
    orders USING (orderNumber);
Posted by: Guest on September-09-2020
0

sum mysql column

SELECT sum( mark ) FROM `student`
Posted by: Guest on May-26-2020

Code answers related to "using sum function in mysql for two diffrenet conditions"

Code answers related to "SQL"

Browse Popular Code Answers by Language