A separate summary for each group
One shop-wide total hides differences between order statuses. Create one group per status and calculate its own count and total, keeping source rows distinct from summary rows.
GROUP BY partitions input by a key value; each aggregate works separately inside each group.
- GROUP BY
- Partitions rows sharing key values into groups for separate aggregates.