select city, sum(total_amount) as total_order_amount
from orders a join customers b on a.customer_id=b.customer_id
group by city
order by total_order_amount desc, city