本帖最后由 cashcow 于 2010-01-15 13:55:05 编辑

解决方案 »

  1.   

    delete a from table1 a left join (select name,max(time) as time  from table1 group by name) b
    on a.name=b.name and a.time=b.time
    where b.name is null
      

  2.   

    老兄,你误会了吧。a是字段内容,
    字段名name,time 
    a,2009-12-30 20:12:43 
    a,2010-1-10 3:19:42 
    a,2010-1-15 13:39:12 
    执行删除后结束为
    a,2010-1-15 13:39:12 
      

  3.   

    DELETE A FROM A LEFT JOIN (SELECT NAME,MAX(TIME) AS MA FROM A GROUP BY NAME) B
    ON A.NAME=B.NAME AND A.TIME=B.MA WHERE B.NAME IS NULL
      

  4.   

    delete from mytable t where exists
    (select 1 from mytable where a=t.a and `time`>a.`time`);
      

  5.   

    delete a from table1 a left join (select name,max(time) as time  from table1 group by name) b
        on a.name=b.name and a.time=b.time
    where b.name is null这里的a 不是字段的意思,只不过是个别名,把table1 换成你的表名就可以了。