本帖最后由 cc9277 于 2012-09-26 21:30:31 编辑

解决方案 »

  1.   

    用sql中的rownum可以做到的 呵呵
      

  2.   

    方法1
    delete   YourTable  
    where   [id]   not   in   (
    select   max([id])   from   YourTable  
    group   by   (name   +   value))方法2
    delete   a
    from   表   a   left   join(
    select   id=min(id)   from   表   group   by   name,value
    )b   on   a.id=b.id
    where   b.id   is   null 
      

  3.   

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

  4.   

    delete YourTable  where name = (Select name From YourTable group by name having Count(name)>1)
      

  5.   

    试下:
    DELETE 
    from `表名` 
    where `name` in 
    (SELECT temp.`name` 
    FROM 
    (select cnd.`name` 
    from `表名` cnd 
    GROUP BY cnd.`name` 
    HAVING COUNT(cnd.`name`)>1) temp)
      

  6.   

    delete from tablename where name in (select name from tablename group by name having count(name)>1)
      

  7.   

    DELETE a.* FROM ttg a INNER JOIN ttg b ON 
    a.name=b.`name` AND a.id<>b.id
    在NAME、ID上建立索引
      

  8.   

    mysql> create temporary table tmp_wrap select * from users_groups group by uid having count(1) >= 1;
    mysql> truncate table users_groups;
    mysql> insert into users_groups select * from tmp_wrap;
    mysql> select * from users_groups;
    mysql> drop table tmp_wrap;
    这样是可以的……只是会留一条记录……