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

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

https://www.nowcoder.com/practice/ce313253a81c4947b20e801cd4da7894

select o.cust_id, sum(i.total_q) total_ordered from 
Orders o, (select order_num, sum(item_price*quantity) total_q from OrderItems group by order_num) i 
where o.order_num=i.order_num
group by cust_id 
order by total_ordered desc;

全部评论

相关推荐

努力学习的小绵羊:我反倒觉得这种挺好的,给不到我想要的就别浪费大家时间了
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务