查找重复记录:
select *
from dept_m
where dept_cd in
(
select dept_cd
from KOUSU_DEPT_M
group by dept_cd
having count(dept_cd) > 1
)
删除重复记录:
delete
from
dept_m
where
dept_cd in
(
select dept_cd from KOUSU_DEPT_M
group by
dept_cd
having count(dept_cd) > 1
)
and rowid not in
(
select min(rowid) from KOUSU_DEPT_M
group by dept_cd
having count(dept_cd) > 1
)
阅读(767) | 评论(0) | 转发(0) |