题解 | #返回每个顾客不同订单的总金额#
返回每个顾客不同订单的总金额
https://www.nowcoder.com/practice/ce313253a81c4947b20e801cd4da7894
select o.cust_id, sum(i.total_q) total_ordered from Orders o, (select order_num, sum(item_price*quantity) total_q from OrderItems group by order_num) i where o.order_num=i.order_num group by cust_id order by total_ordered desc;