题解 | #确定最佳顾客的另一种方式(二)#
确定最佳顾客的另一种方式(二)
http://www.nowcoder.com/practice/b5766f970ae64ac7944f37f5b47107aa
select cust_name,total_price
from (select order_num,SUM(item_price*quantity) total_price
from OrderItems oi
GROUP by order_num
having SUM(item_price*quantity)>=1000) newtable
inner join Orders o on newtable.order_num=o.order_num
inner join Customers c on c.cust_id=o.cust_id
order by total_price