当前位置: 代码迷 >> Oracle开发 >> 删除表里的重复数据的sql解决思路
  详细解决方案

删除表里的重复数据的sql解决思路

热度:54   发布时间:2016-04-24 07:10:47.0
删除表里的重复数据的sql
删除表里的重复数据的sql,重复数据要留一条哈,越简单越好
------解决方案--------------------
delete from 表名 a  where a.rowid NOT IN  (    select max(b.rowid) from 表名 b     where a.字段1 = b.字段1 and     a.字段2 = b.字段2  )
------解决方案--------------------
delete from 表名 a  where a.rowid NOT IN  (    select max(b.rowid) from 表名 b     where a.字段1 = b.字段1 and     a.字段2 = b.字段2  ) 
是正解,
但是字段1和字段2相同的记录就应该是楼主所说的重复数据吧
  相关解决方案