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