Home  >  Article  >  Database  >  oracle去除重复数据sql

oracle去除重复数据sql

WBOY
WBOYOriginal
2016-06-07 14:54:281645browse

在oracle中,有些数据完全一样,要清除掉重复的,只保留一条不重复的数据。 谢谢 柳下惠 提供的第二个去重sql。 这个可能速度更快些。 Oracle delete table1 where rowid not in (select max(rowid) from table1 group by col1 ,col2 ) DELETE table sWHERE r

在oracle中,有些数据完全一样,要清除掉重复的,只保留一条不重复的数据。

谢谢  柳下惠  提供的第二个去重sql。 这个可能速度更快些。
Oracle
delete table1 where rowid not in (
select max(rowid) from table1 group by col1 ,col2  )
DELETE table s
WHERE rowid < (SELECT MAX(rowid) FROM table q WHERE q.name = s.name)
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn