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