Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1455154
  • 博文数量: 187
  • 博客积分: 10375
  • 博客等级: 上将
  • 技术积分: 3127
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-07 10:58
文章分类

全部博文(187)

文章存档

2013年(1)

2012年(8)

2011年(28)

2010年(36)

2009年(47)

2008年(67)

我的朋友

分类: Oracle

2011-04-25 17:17:32

查找重复记录:
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
)
阅读(707) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~