Revenue by Status With a Total
MediumDescription
status is an enum whose values are defined in this order: pending, confirmed,
shipped, delivered, cancelled, returned.
Show status_label and revenue (the total total_amount): one row per status, showing the
status as text, then one grand-total row whose status_label is TOTAL. The status rows come in
the order above, and the total row comes last.
End your query with ORDER BY GROUPING(status), status.
Tables
| orders |
|---|
| order_id (PK) |
| status |
| total_amount |