select top 1 * from 表1 group by id

解决方案 »

  1.   

    delete a from 表1 a where exists(select 1 from 表1 where id=a.id and name<a.name)
      

  2.   

    select a.* from tb a,(select id,min(name) as name from tb group by id) b where b.id=a.id and b.name=a.name
      

  3.   

    我要的是删除库的结果,不是select语句,可libin_ftsafe的方法调不通
      

  4.   

    delete from 表1 as a ,(select top 1 id name from 表1 group by id) as b
    where a.id=c.id and a.name<>b.name
      

  5.   

    借别人的一用,:)
    delete a from 表1 a where exists(select 1 from 表1 where id=a.id and name<a.name)
      

  6.   

    建一个临时表
    insert into biao2(id,name ......) select top 1 id,name ...... from 表1 group by id
    delete from 表1insert into 表1(id,name ......) select id,name ...... from biao2
      

  7.   

    最简单的方法应该是
    回复人: libin_ftsafe(子陌红尘) ( ) 信誉:105哎以后看帖,应该多看,多想,再动手
      

  8.   

    看一下
    http://community.csdn.net/Expert/topic/4426/4426368.xml?temp=.8434717
    差不多。。
      

  9.   

    delete [表1] from [表1] a 
    where a.name <>(select top 1 name from [表1] b 
                    where b.id=a.id)
    --------------------------------
    若NAME出现重复,则该办法不能用