GROUP BY with ROLLUP exampleThe following statement computes the sales amount and groups them by customer_id, status, and (customer_id, status):
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | SELECT customer_id, status, SUM ( quantity * unit_price ) sales FROM orders INNER JOIN order_items USING (order_id) GROUP BY ROLLUP( customer_id, status ); |

GROUP BY with ROLLUP exampleThe following statement computes the sales amount and groups them by customer_id, status, and (customer_id, status):
GROUP BY with ROLLUP exampleThe following statement computes the sales amount and groups them by customer_id, status, and (customer_id, status):
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | SELECT customer_id, status, SUM ( quantity * unit_price ) sales FROM orders INNER JOIN order_items USING (order_id) GROUP BY ROLLUP( customer_id, status ); |

| status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
|---|---|---|---|---|---|---|---|
| repetition number in this series | 0 | memorised on | scheduled repetition | ||||
| scheduled repetition interval | last repetition or drill |