select
c.cust_name,
round(sum(oi.item_price*oi.quantity),3) as total_price
from
Orders o
inner join OrderItems oi on o.order_num = oi.order_num
inner join Customers c on o.cust_id = c.cust_id
group by c.cust_name
having total_price >= 1000
order by total_price
;

京公网安备 11010502036488号