题解 | #返回每个顾客不同订单的总金额#
返回每个顾客不同订单的总金额
https://www.nowcoder.com/practice/ce313253a81c4947b20e801cd4da7894
SELECT cust_id, total_ordered FROM Orders c INNER JOIN ( SELECT order_num, SUM(item_price * quantity) total_ordered FROM OrderItems GROUP BY order_num ) o ON o.order_num = c.order_num ORDER BY o.total_ordered DESC
#愚人节我想对你说#