打错了:
要求:返回colA相同的情况下的 colC列的值为最小的那一行  并且 该行的colB的值也要返回

解决方案 »

  1.   

    select tab1.*
     from tab1,(select cola,min(colc) colc from tab1 group by cola) t
     where tab1.cola=t.cola and tab1.colc=t.colc
      

  2.   

    select * from tab1 a
    where not exists(select 1 from tab1 where colA = a.colA and colC < a.colC)
      

  3.   

    select aa.*
    from Tab1 aa,(select colA,min(colC) from Tab1 
                  group by colA) bb
    where aa.colA=bb.colA and aa.colC=bb.colC
      

  4.   

    蒋老师教导我们: 只要是找最大值或最小值,首先要想到 exists 或 not exists
      

  5.   

    select b.colA,a.colB,b.colC from tab1 a,
    (select colA,min(colC) as colC from tab1 group by colA)b
    where a.colA=b.colA and a.colC=b.colC 
    order by b.colA