select email 
from (
select t.email,row_number()over(partition by email order by email )as rn
from t

where rn>1我想把上面选出来的数据都删除掉了,除了复制到别的表,再删除,还有别的办法吗如果直接 delete from t where emainl in(...)这样删除,会把rn=1邮箱也删除了

解决方案 »

  1.   

    delete from email where rowid in (select rowid
    from (
    select t.email,row_number()over(partition by email order by email )as rn
    from t

    where rn>1
    )
      

  2.   

    delete from email a where exists (select 1
    from (
    select t.email,row_number()over(partition by email order by email )as rn
    from t
    )  b 
    where b.rn>1 and a.rowid=b.rowid
    )
      

  3.   

    搞定啦   多么强大的 rowid 啊 呵呵
      

  4.   

    怎么忘了 rowid  呢