题解 | #确定最佳顾客的另一种方式(二)#
确定最佳顾客的另一种方式(二)
https://www.nowcoder.com/practice/b5766f970ae64ac7944f37f5b47107aa
SELECT c.cust_name, SUM(oi.item_price*oi.quantity) AS total_price FROM Customers AS c INNER JOIN Orders AS o ON c.cust_id = o.cust_id INNER JOIN OrderItems AS oi ON o.order_num = oi.order_num GROUP BY c.cust_name HAVING SUM(oi.item_price*oi.quantity) >= 1000 ORDER BY total_price