Oracle重复数据删除

在Oracle数据库中,删除重复数据,大都会使用如下方法:

delete from tbl a
where rowid<>(select max(b.rowid)
from tbl b where a.col1=b.col1 and a.col2 = b.col2);

但是,为什么这样能够删除数据呢?

我个人认为,max(rowid)应该得到一个唯一的值,而 <> max(rowid)则是表中的其它所有数据,所以删除应该是删除其它所有数据才对,为什么只是删除了重复的数据呢?rowid里面有什么玄机?

posted on 2009-09-03 10:10  CodingME!  阅读(333)  评论(0编辑  收藏  举报

导航

Blog