WITH RankedPurchases AS ( SELECT user_id, level, amount, ROW_NUMBER() OVER (PARTITION BY level ORDER BY SUM(amount) DESC) AS rn FROM purchases GROUP BY user_id, level ) SELECT user_id, level, amount FROM RankedPurchases WHERE rn <= 10;
点赞 评论

相关推荐

11-15 18:39
已编辑
西安交通大学 Java
全村最靓的仔仔:卧槽,佬啥bg呢,本也是西交么
点赞 评论 收藏
分享
牛客网
牛客企业服务