题解 | 确定最佳顾客的另一种方式(二)
select cust_name, sum(total_price) total_price from ( select cust_name, item_price * quantity total_price from OrderItems ori join Orders ord on ori.order_num = ord.order_num join Customers cus on ord.cust_id = cus.cust_id ) a group by cust_name having total_price >= 1000 order by total_price