select cust_name, t1.order_num, oi.OrderTotal from Customers join Orders t1 using(cust_id) join (select order_num, sum(quantity * item_price) as OrderTotal from OrderItems group by order_num) as oi on t1.order_num = oi.order_num order by cust_name, oi.OrderTotal

京公网安备 11010502036488号