t表结构:id,值,出现时间,分类有没有好方法求出每个分类最大值的出现时间?

解决方案 »

  1.   

    不好意思,上面回错贴了.select * from tb a where not  exists( select 1 from tb b where b.分类=a.分类 and b.值>a.值)或select a.* from tb a
    inner join (select 分类,max(值) mn from tb group by 分类) b
    on a.分类=b.分类 and a.值=b.mn
      

  2.   

    ==================================
    =  CSDN助手 全面支持CSDN论坛     =
    =  监视、收藏、历史、签名走马灯  =
    ==================================