题解 | #返回顾客名称和相关订单号以及每个订单的总价#
返回顾客名称和相关订单号以及每个订单的总价
http://www.nowcoder.com/practice/4dda66e385c443d8a11570a70807d250
SELECT c.cust_name,t.order_num,t.OrderTotal FROM (SELECT i.order_num,o.cust_id,i.quantity*i.item_price OrderTotal FROM Orders o, OrderItems i WHERE o.order_num = i.order_num) t,Customers c WHERE t.cust_id = c.cust_id ORDER BY c.cust_name,t.order_num