题解 | 返回每个顾客不同订单的总金额

select cust_id, sum(item_price * quantity) total_ordered
from Orders t1 left join OrderItems t2 on t1.order_num = t2.order_num
group by cust_id
order by total_ordered desc;

左联表,过滤掉没有cust_id的订单

全部评论

相关推荐

04-29 22:35
门头沟学院 Java
牛友说改了名字能收到offer:旧图新发查看图片
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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