SELECT TOP 1 * FROM [table] WHERE aaa in (SELECT TOP 5 aaa FROM [table] group by aaa)
???

解决方案 »

  1.   

    select * from tablename t1
    where checksum(*) in
    (select top 1 checksum(*) from tablename where aaa = t1.aaa)
      

  2.   

    select * from tablename t1
    where checksum(*) =
    (select top 1 checksum(*) from tablename where aaa = t1.aaa)
      

  3.   

    如果有IDselect * from [table]
    where id in (select min(id) from [table] group by aaa)如果没有IDselect identity(int,1,1) as id ,* into # from [table]goselect * from #
    where id in (select min(id) from # group by aaa)