记录:
 a  2007-1-1
 a  2007-1-2
 a  2007-1-3
 a  2007-1-4
 b  2007-1-11
 b  2007-1-21
 b  2007-1-31
 b  2007-1-14
 b  2007-1-15
 c  2007-1-21
 c  2007-1-24
去a b c 3条记录 按日期排序

解决方案 »

  1.   

    select 
        t.* 
    from 
        表 t 
    where 
        not exists(select 1 from 表 where type=t.type and date>t.date)
    order by
        t.date desc
      

  2.   

    表 t 记录:
     C1 C2
     a  2007-1-1
     a  2007-1-2
     a  2007-1-3
     a  2007-1-4
     b  2007-1-11
     b  2007-1-21
     b  2007-1-31
     b  2007-1-14
     b  2007-1-15
     c  2007-1-21
     c  2007-1-24
    去a b c 3条记录 按日期排序按libin_ftsafe(子陌红尘:当libin告别ftsafe) 写 不对
    select 
        t.* 
    from 
        t 
    where 
        not exists(select 1 from t where C1=t.C1 and C2>t.C2)
    order by
        t.C1 
      

  3.   

    是a b c 3条记录 按日期排序