Chinaunix首页 | 论坛 | 博客
  • 博客访问: 328340
  • 博文数量: 47
  • 博客积分: 2667
  • 博客等级: 少校
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2010-02-10 11:25
文章分类

全部博文(47)

文章存档

2015年(2)

2012年(4)

2011年(4)

2010年(37)

我的朋友

分类: Oracle

2010-06-12 11:27:05


删除数据库中重复的数据SQL
 
 

delete from t_info_class_relationship a

/* 查询所有的俩个外键重复的外键id  */
where (a.info_id,a.class_id) in (select info_id,class_id from t_info_class_relationship group by info_id,class_id having count(*) > 1)

/* 除去第一条记录  */
and rowid not in (select min(rowid) from t_info_class_relationship group by info_id,class_id having count(*)>1)


阅读(914) | 评论(0) | 转发(0) |
0

上一篇:Hibernate 异常归档

下一篇:SVN 地址集合

给主人留下些什么吧!~~