开发者社区> 问答> 正文

选择每个组中除最大记录之外的所有记录

选择每个组中除最大记录之外的所有记录

展开
收起
贺贺_ 2019-12-02 21:50:56 437 0
1 条回答
写回答
取消 提交回答
  • 您可以加入每个产品的最高出价,并选择其他所有内容

    select t.*
    from your_table t
    left join 
    (
        select product_name, max(bid_price) as maxbid
        from your_table
        group by product_name
    ) tmp on tmp.product_name = t.product_name
         and tmp.maxbid = t.bid_price
    where tmp.product_name is null
    
    2019-12-02 21:52:15
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
事务、全局索引、透明分布式 立即下载
《用管控策略设定多账号组织全局访问边界》 立即下载
用计算和数据去改变整个世界 立即下载