删除重复行 各位好。现在有一张表的某些行的各字段值都是一模一样的,如何写一个delete语句来去重呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个在baidu里面一搜 很多吧?http://apps.hi.baidu.com/share/detail/9249849 delete from table_name t where rowid<(select max(rowid) from table_name a where a.field1=t.field1 and a.field2=t.field2....); --参考:delete from table_name awhere not exists( select 1 from table_name b where a.id = b.id --表的自连接条件 and a.col < b.col --这个是最重要的条件,它确定了保存那条数据 ) 一般采用伪列rowid来删除重复数据比较好 根据rowid 来删除rowid比最小值更大的。delete from tab a where rowid>(select min(rowid) from tab b where a.id=b.id and ....) oracle中QUEST_PPCM_SQL_TEXT这个表是干嘛用的 日期字符串格式输入到DATE类型无效,请问什么原因?? ORACLE9I+windows 2003如何配置才能利用8G内存? 求助,sql实现分支查询问题 备份过程中遇到如下问题。。。。。。 很奇怪的问题,关于Oracle Form的 字段变更问题 請教高高手 数据库(如:Oracle)中联合查询的机制 ubuntu 12.04 LTS 64bit 环境下安装Oracle 11g R2 时先决条件检查全部失败~求大神支招 Oracle 11G客户端配置问题 关于表空间的一点小问题
--参考:
delete from table_name a
where not exists(
select 1
from table_name b
where a.id = b.id --表的自连接条件
and a.col < b.col --这个是最重要的条件,它确定了保存那条数据
)
delete from tab a where rowid>(select min(rowid) from tab b where a.id=b.id and ....)