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