题解 | #返回每个顾客不同订单的总金额#
返回每个顾客不同订单的总金额
https://www.nowcoder.com/practice/ce313253a81c4947b20e801cd4da7894
select t1.cust_id, sum(t2.quantity * t2.item_price) as total_ordered from Orders t1 left join OrderItems t2 on t2.order_num = t1.order_num group by t1.cust_id order by total_ordered desc
注意要Orders表左连接OrderItems