Group paid revenue
Show paid order revenue by region, highest first.
Sample schema
customers(id PRIMARY KEY, region); orders(id PRIMARY KEY, customer_id, total, status)
SELECT c.region, SUM(o.total) AS paid_revenue
FROM customers AS c
JOIN orders AS o ON o.customer_id = c.id
WHERE o.status = 'paid'
GROUP BY c.region
ORDER BY paid_revenue DESC;
Each order joins to exactly one customer. This totals paid orders only; customers with no paid orders do not contribute a result row. Amounts must use a consistent currency.