with tmp as( select c.item_id from (select b.item_id, b.sum_amt, rank()over(order by b.sum_amt desc) rnk from (select item_id, sum(amt) sum_amt from (select buyer_id, item_id, amt from A  where month(dt) in (7,8,9) and seller_id = '123' )a group by item_id )b )c where c.rnk = 1)      select buyer_id, item_id from A where item id = (select item_id from tmp) group by buyer_id, item_id order by SUM(amt) desc limit 1
点赞 评论

相关推荐

点赞 评论 收藏
分享
04-25 19:29
已编辑
宁波大学 运营
被普调的六边形战士很高大:你我美牛孩
点赞 评论 收藏
分享
牛客网
牛客企业服务