SELECT
    b.city,
    SUM(a.total_amount) AS total_order_amount
FROM orders AS a
INNER JOIN customers AS b
    ON a.customer_id = b.customer_id
GROUP BY b.city
ORDER BY total_order_amount DESC,b.city;