select distinct owner, table_name from test_sort2 order by owner,table_name;
建立一个所以再OWNER ,TABLE_NAME
这样可以避免排序
select owner, table_name
from test_sort2 a
where A.ROWID = (select /*+ no_unnest */ max(rowid)
from test_sort2 b
where a.owner = b.owner
and a.table_name = b.table_name)
order by owner,table_name;
删除重复的行
SQL> select * from oo;
IT
---------------------------------------
1
1
2
2
SQL>
SQL> delete oo a where a.rowid (select max(rowid)
2 from oo b
3 where a.it = b.it);
2 rows deleted
SQL> commit;
Commit complete
SQL> select * from oo;
IT
---------------------------------------
1
2