#oracle は重複データを削除し、最初のレコードを保持します
1. テーブル内の冗長な重複レコードを見つけます。重複レコードは、単一のフィールド (Id) で判定します。select * from 表 where Id in (select Id from 表 group byId having count(Id) > 1)
DELETE from 表 WHERE (id) IN ( SELECT id FROM 表 GROUP BY id HAVING COUNT(id) > 1) AND ROWID NOT IN (SELECT MIN(ROWID) FROM 表 GROUP BY id HAVING COUNT(*) > 1);
select * from 表 a where (a.Id,a.seq) in(select Id,seq from 表 group by Id,seq having count(*) > 1)
delete from 表 a where (a.Id,a.seq) in (select Id,seq from 表 group by Id,seq having count(*) > 1) and rowid not in (select min(rowid) from 表 group by Id,seq having count(*)>1)
select * from 表 a where (a.Id,a.seq) in (select Id,seq from 表 group by Id,seq having count(*) > 1) and rowid not in (select min(rowid) from 表 group by Id,seq having count(*)>1)
SQL チュートリアル
があります。 、どなたでもぜひ学んでください!以上がOracle は重複データを削除し、最初のレコードを保持しますの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。