select * from tb a where not exists(select 1 from tb where a.c1= c1 and c2<a.c2)

解决方案 »

  1.   

    select 
      c1,
      min(c1) as c2
    from
      tb
    group by
     c1
      

  2.   

    select c1, min(c1) as c2 from  tb group by  c1
      

  3.   

    select * from tb t where not exists(select * from tb where t.c1= c1 and t.c2<c2)
      

  4.   

    上面更正一下
    select c1, min(c2) as c2 from  tb group by  c1
      

  5.   

    SELECT * FROM TB T WHERE NOT EXISTS (SELECT * FROM TB WHERE C1=T.C1 AND C2<T.C2)
      

  6.   

    再来一个
    select c1,c2 from (
    select c1,c2,row_number(partition by c1,c2 order by c2) Cnt from C2) T where t.Cnt = 1