题解 | #返回顾客名称和相关订单号以及每个订单的总价#
返回顾客名称和相关订单号以及每个订单的总价
https://www.nowcoder.com/practice/4dda66e385c443d8a11570a70807d250
select c.cust_name,f.order_num,f.OrderTotal from Customers c, (select o.cust_id,o.order_num,sum(oi.quantity*oi.item_price) OrderTotal from Customers c,Orders o,OrderItems oi where c.cust_id=o.cust_id and o.order_num=oi.order_num group by o.cust_id,o.order_num) f where c.cust_id=f.cust_id order by c.cust_name,f.order_num;
#sql#