题解 | #返回顾客名称和相关订单号以及每个订单的总价#

返回顾客名称和相关订单号以及每个订单的总价

https://www.nowcoder.com/practice/4dda66e385c443d8a11570a70807d250

select

    cust_name,

    order_num,

    (

        select

            (quantity * item_price)

        from

            OrderItems as c

        where

            c.order_num = b.order_num

    ) as OrderTotal

from

    Customers as a,

    Orders as b

where

    a.cust_id = b.cust_id

order by

    cust_name,

    order_num;

#mysql#
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务