I have an Oracle table with 35 columns, one of which is a unique id.

我有一个包含35列的Oracle表,其中一个是唯一id。

This table has a few entries / rows that are duplicate.

这个表有一些重复的条目/行。

When I do a select distinct (*) I get a number x

当我做一个select distinct(*)时,会得到一个数字x

When I do a select distinct ("every column but id") I get a number y < x

当我做一个select distinct(“除id外的每一列”)时,会得到一个数字y < x

Is there anyway I can get those columns that are duplicate, from this table? A minus doesn't help.

我是否可以从这个表中得到那些重复的列?-没有帮助。

1 个解决方案

#1


2

SELECT ("every column but id")
FROM yourTable
GROUP BY
("every column but id")
HAVING COUNT(*) > 1

To delete them

删除他们

  • insert the rows from above query into a temporary table
  • 将上面查询的行插入到临时表中
  • delete all rows from above query including their duplicates from your table
  • 从上面的查询中删除所有行,包括表中的重复行
  • insert the rows from the temporary table into your table again
  • 将临时表中的行插入到表中。

更多相关文章

  1. 返回没有匹配条目的所有日期
  2. 又要请教在SQL中建表时的表名不能用纯数字表名的问题
  3. Android Studio获取数字签名(SHA1)的方法
  4. Android ListView获取当前可视区域条目数据
  5. 在javaScript中将数字转换为罗马数字。
  6. 数字金额转换成汉字
  7. Java区分大小写字母数字和符号
  8. Javascript 检查字符串是否是数字的几种方法
  9. java里如何取出一个字符串中的数字?

随机推荐

  1. 1、一、Introduction(入门): 0、Introduc
  2. android开发每日汇总【2011-12-3】
  3. android EditText inputType 中文解说
  4. android xml属性大全
  5. android 4.0中的Fragment
  6. Android:EditText 所有属性
  7. Android中xml布局 详解
  8. Android 控件view的可见,不可见,隐藏的设
  9. Android知识梳理之Service整理
  10. android中点击事件的4种写法