Select 某字段 from (Select top 100 * from 表) aa group by 某字段 having count(*) > 1

解决方案 »

  1.   

    select columnname from tablename group by columnname having count(*) > 1
      

  2.   

    Select top 100 * from 表 where 某字段 in (select 某字段 from 表 group by 某字段 having count(*)>1)
      

  3.   

    有id的情况
    select top n 字段 from tablename where id not in (select max(id) from tablename group by 要查的重复字段)
    没有ID的情况select identity(int,1,1) as id,* into #temp from tabel
    delect # where id not in (
      select max(id) from # group by col1,col2,col3...)
    delect table
    inset into table(...)
       select ..... from #temp