题解 | #返回每个顾客不同订单的总金额#
返回每个顾客不同订单的总金额
http://www.nowcoder.com/practice/ce313253a81c4947b20e801cd4da7894
SELECT a.cust_id,b.total_ordered FROM Orders a INNER JOIN (SELECT order_num,SUM(item_price*quantity) AS total_ordered FROM OrderItems GROUP BY order_num) b ON a.order_num=b.order_num ORDER BY total_ordered DESC;