delete from teacher as a where a.id not in (select max(t.id) from teacher as t group by t.name);
以上是删除表中重复数据的,为什么会报错呢,把第一个teacher表的别名a去掉,就可以了,为什么第一表不能用别名,请指点下,谢谢了!

解决方案 »

  1.   

    delete a from teacher as a where a.id not in (select max(t.id) from teacher as t group by t.name); 
      

  2.   


    delete a
    from teacher as  a where a.id not in (
    select max(t.id) from teacher as t group by t.name);
      

  3.   

    delete a
    from teacher as  a where a.id not in (
    select max(t.id) from teacher as t group by t.name);