with max_item_id as (select item_id ( select item_id,sum(amt) as sum_amt,rom_number() over(order by sum(amt) desc ) rn from table_a where to_date(dt,'yyyymmdd')>=to_date('20180701','yyyymmdd') and to_date(dt,'yyyymmdd')<=to_date('20180931','yyyymmdd') and a.seller_id='123' group by item_id )t where t.rn=1 ) select item_id,buyer_id from ( select a.item_id,a.buyer_id,sum(a.amt) sum_buyer_id,rom_number() over(order by sum(a.amt) desc ) rn from table_a a join max_item_id b on a.item_id=b.item_id where to_date(dt,'yyyymmdd')>=to_date('20180701','yyyymmdd') and to_date(dt,'yyyymmdd')<=to_date('20180931','yyyymmdd') and a.seller_id='123' group by a.item_id,a.buyer_id ) t where t.rn=1 ;
点赞 1

相关推荐

10-30 19:23
已编辑
山东大学(威海) C++
牛至超人:我了个雷 1.实习经历写太长了吧,精简一点,你写那么老多,面试官看着都烦 2.项目经历你放俩竞赛干啥单独拿出来写上几等奖就行了呗 3.一大雷点就是项目经历里的那个课程设计,大家都知道课程设计巨水,不要写课程设计,换一个名字,就叫学生管理系统,面试官问就说是自己做的项目,不要提课程设计的事 4.那个交流经历,简化一下塞到最上面的教育经历里就行了 5.简历尽量一页纸
点赞 评论 收藏
分享
11-04 10:30
已编辑
门头沟学院 研发工程师
开心小狗🐶:“直接说答案”
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务