题解 | 确定最佳顾客的另一种方式(二)

select
    cust_name,
    sum(total_price) total_price
from
    (
        select
            cust_name,
            item_price * quantity total_price
        from
            OrderItems ori
            join Orders ord on ori.order_num = ord.order_num
            join Customers cus on ord.cust_id = cus.cust_id
    ) a
group by
    cust_name
having
    total_price >= 1000
order by
    total_price

全部评论

相关推荐

07-02 22:46
门头沟学院 Java
码农索隆:hr:“管你投没投,先挂了再说”
点赞 评论 收藏
分享
代码飞升:别用口语,后端就写后端,前端就写前端,最后别光后悔
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务