delete from FND_EMPLOYEES a
where a.employee_code in
(select b.employee_code
from FND_EMPLOYEES b
where b.employee_code = i.employee_code
group by b.employee_code
having count(b.employee_code) > 1)
and a.employee_id not in
(select min(employee_id)
from FND_EMPLOYEES
where employee_code = i.employee_code
group by employee_code
having count(employee_code) > 1);
COMMIT;
1.查询重复记录
select * from 表名
where 重复属性 in (select 重复属性 from 表名 group by 重复属性 having count(重复属性 ) > 1)
2.删除保留一条重复记录
delete from 表名
where 重复属性 in (select 重复属性 from 表名 group by 重复属性 having count(重复属性 ) > 1)
and ID not in (select min(ID) from 表名 group by 重复属性 having count(重复属性 )>1)