题解 | 用户订单信息查询

用户订单信息查询

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

SELECT T1.city,T1.total_order_amount FROM 
(
SELECT  C.customer_id,C.city,SUM(O.total_amount) AS total_order_amount
FROM orders  AS O
LEFT JOIN customers  AS C
ON C.customer_id=O.customer_id
GROUP BY C.customer_id,C.city
ORDER BY total_order_amount DESC ,C.city ASC
) T1;

全部评论

相关推荐

hwwhwh:同双非,有大厂实习其实也没啥用,主要看运气,等就行了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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