题解 | #返回顾客名称和相关订单号以及每个订单的总价#
返回顾客名称和相关订单号以及每个订单的总价
http://www.nowcoder.com/practice/4dda66e385c443d8a11570a70807d250
select C.cust_name,O.order_num,sum(OI.quantity * OI.item_price) OrderTotal from Customers C join Orders O on C.cust_id =O.cust_id join OrderItems OI on O.order_num = OI.order_num group by C.cust_name,O.order_num order by C.cust_name asc,O.order_num asc 将表1跟表2进行关联,然后再跟表3关联,关联后进行查询