select a.item_id,b.buyer_id from ( select item_id,max(sum(amt)) as max_sum_amt from A where dt>=201807 and dt<=201809 and buyer_id=123 group by 1 )a left join  ( select item_id,buyer_id,max(sum(amt)) as max_sum_amt from A where dt>=201807 and dt<=201809 group by 1,2 ) b on a.item_id=b.item_id

相关推荐

点赞 评论 收藏
分享
11-03 18:50
门头沟学院 Java
迷茫的大四🐶:问就是马上到,一周五天,6个月以上,全国可飞
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务