清理oracle数据库下的数据重复,并保留其一
来源:互联网 发布:java抽象类能被继承 编辑:程序博客网 时间:2024/05/29 03:48
select * from b2bx where
create_date in
(to_date('2017-12-11 08:22:16', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:17', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:18', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:19', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:20', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:21', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:22', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:23', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:55', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:56', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:57', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:58', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:59', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:33:00', 'yyyy-mm-dd hh24:mi:ss')
)and create_user='admin'
-- 141 - 94 = ? 刚好47 重复 3次 94/2 = ? 47 、、 此时重复2次 然后再次执行一次 就剩余47条 OK
select cc.id from (
select a.rowid,a.* from b2bx a
where a.rowid =
(
select max(b.rowid) from b2bx b
where a.lotn = b.lotn and
create_date in
(to_date('2017-12-11 08:22:16', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:17', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:18', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:19', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:20', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:21', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:22', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:23', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:55', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:56', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:57', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:58', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:59', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:33:00', 'yyyy-mm-dd hh24:mi:ss')
)and create_user='admin'
)
) cc
select count(*) from b2bx ; -- 2962982 临时 删除47 怎么只有40条
select count(*) from b2bx -- 2962952 临时 删除47 怎么只有40条
select count(*) from b2bx -- 2962952 临时 删除47 怎么只有40条
-- 2962952 -2962905 = ? 47 == 刚好 47
delete from b2bx where id in (
select cc.id from (
select a.rowid,a.* from b2bx a
where a.rowid =
(
select max(b.rowid) from b2bx b
where a.lotn = b.lotn and
create_date in
(to_date('2017-12-11 08:22:16', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:17', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:18', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:19', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:20', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:21', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:22', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:23', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:55', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:56', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:57', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:58', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:59', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:33:00', 'yyyy-mm-dd hh24:mi:ss')
)and create_user='admin'
)
) cc
)
create_date in
(to_date('2017-12-11 08:22:16', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:17', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:18', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:19', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:20', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:21', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:22', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:23', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:55', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:56', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:57', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:58', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:59', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:33:00', 'yyyy-mm-dd hh24:mi:ss')
)and create_user='admin'
-- 141 - 94 = ? 刚好47 重复 3次 94/2 = ? 47 、、 此时重复2次 然后再次执行一次 就剩余47条 OK
select cc.id from (
select a.rowid,a.* from b2bx a
where a.rowid =
(
select max(b.rowid) from b2bx b
where a.lotn = b.lotn and
create_date in
(to_date('2017-12-11 08:22:16', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:17', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:18', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:19', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:20', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:21', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:22', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:23', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:55', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:56', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:57', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:58', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:59', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:33:00', 'yyyy-mm-dd hh24:mi:ss')
)and create_user='admin'
)
) cc
select count(*) from b2bx ; -- 2962982 临时 删除47 怎么只有40条
select count(*) from b2bx -- 2962952 临时 删除47 怎么只有40条
select count(*) from b2bx -- 2962952 临时 删除47 怎么只有40条
-- 2962952 -2962905 = ? 47 == 刚好 47
delete from b2bx where id in (
select cc.id from (
select a.rowid,a.* from b2bx a
where a.rowid =
(
select max(b.rowid) from b2bx b
where a.lotn = b.lotn and
create_date in
(to_date('2017-12-11 08:22:16', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:17', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:18', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:19', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:20', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:21', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:22', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:22:23', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:55', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:56', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:57', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:58', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:32:59', 'yyyy-mm-dd hh24:mi:ss'),
to_date('2017-12-11 08:33:00', 'yyyy-mm-dd hh24:mi:ss')
)and create_user='admin'
)
) cc
)
阅读全文
0 0
- 清理oracle数据库下的数据重复,并保留其一
- 高效删除Oracle数据库中重复数据,并保留最新一条的方法
- 高效删除Oracle数据库中重复数据,并保留最新一条的方法
- 去掉SQL数据库里重复的数据,并保留一条
- oracle删除重复数据并只保留一条数据
- Oracle查询重复数据并删除,只保留一条记录
- Oracle查询重复数据并删除,只保留一条记录
- Oracle查询重复数据并删除,只保留一条记录
- Oracle查询重复数据并删除,只保留一条记录
- Oracle查询重复数据并删除,只保留一条记录
- Oracle查询重复数据并删除,只保留一条记录
- Oracle查询重复数据并删除,只保留一条记录
- Oracle查询重复数据并删除,只保留一条记录
- Oracle查询重复数据并删除,只保留一条记录
- 在oracle数据库表中删除所有重复的数据,仅保留一条记录
- 【数据库SQL】找到会员卡重复的,保留其中一条数据
- 删除重复数据并只保留一条
- mysql查询重复数据并保留一条
- 深层神经网络的正则化问题
- 机器学习sklearn19.0聚类算法——Kmeans算法
- STM32 GPIO的深度了解
- Ubuntu系统下安装beautiful Soup4
- redis集群
- 清理oracle数据库下的数据重复,并保留其一
- Mac Curl命令
- 常用代码备忘
- PageHelper5.0在oracle数据库中使用
- Python 小练习
- 跨域ajax请求和返回
- div 模拟select
- 第八章lz
- CentOS7.2安装JDK1.8