# 城市总额
with
t1 as(
    select
        city,
        sum(total_amount) as total_order_amount
    from
        orders left join customers using(customer_id)
    group by
        city
    order by
        total_order_amount desc,
        city
)

select * from t1