select * from 一个表 aa where col2=(select min(col2) from 一个表 where col1=aa.col1)

解决方案 »

  1.   

    或:
    select * from 一个表 aa where col2=(select top 1 col2 from 一个表 where col1=aa.col1)
      

  2.   

    select col1, min(col2) from table1 group by col1
      

  3.   

    select col1,(select top 1 col2 from table  a  where table.col1=a.col1) col2  from table
      

  4.   



    select col1,(select  min(col2) from table  a  where table.col1=a.col1) col2  from table
      

  5.   

    谢谢诸位。
    根据我自己的需要作了一下改良,
    select * from table1
    where id in 
    (select col1,min(id) from table1)为了保证唯一性,id为标识列,不一定是col2