Oracle删除重复数据(1)
数据库  /  管理员 发布于 2年前   107
creat table tbl_tmp (select distinct* from tbl);truncate table tbl;//清空表记录insert into tbl select * from tbl_tmp;//将临时表中的数据插回来。
delete from tbl where rowid in (select a.rowid from tbl a,tbl b where a.rowid>b.rowid and a.col1=b.col1 and a.col2 = b.col2)
delete from tbl a where rowid not in (select max(b.rowid)from tbl b where a.col1=b.col1 and a.col2 = b.col2);//这里max使用min也可以
delete from tbl a where rowid<(select max(b.rowid)from tbl b where a.col1=b.col1 and a.col2 = b.col2);//这里如果把max换成min的话,前面的where子句中需要把"<"改为">"
delete from tbl where rowid not in (select max(rowid)from tbl t group by t.col1, t.col2);delete from tbl where (col1, col2)in (select col1,col2 from tbl group by col1,col2 having count(*)>1) and rowid not in(select min(rowid) from tbl group by col1,col2 having count(*) >1)
博主 在
centos7中Meili Search搜索引擎安装流程步骤中评论 @鹿 执行以下命令看看你的2.27版本是否存在strin..鹿 在
centos7中Meili Search搜索引擎安装流程步骤中评论 这是我的错误提示,下载了对应的glibc-2.25.tar.gz后续按照教程操作..阿凡达123 在
golang 怎么做热更新中评论 也可以看看这个:https://github.com/edwingeng/hot..博主 在
hyperf框架常用命令-在centos7中退出命令及在docker容器中退出命令中评论 @路过的靓仔:cdn静态资源被墙,已修复..GGGGGGGGG 在
layui框架常用输入框介绍中评论 写的很好解决问题..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号