数据库处理表中重复数据方法
时间:2014-05-14 19:49:03
收藏:0
阅读:291
--查询表中重复数据
select * from 表名 t where t.id in (
SELECT id FROM 表名 GROUP BY id HAVING COUNT(主键编号)>1
);
--去除表中重复数据
delete from 表名 a where rowid not in (
select max(b.rowid) from 表名 b where a.主键编号 = b.主键编号
);
select * from 表名 t where t.id in (
SELECT id FROM 表名 GROUP BY id HAVING COUNT(主键编号)>1
);
--去除表中重复数据
delete from 表名 a where rowid not in (
select max(b.rowid) from 表名 b where a.主键编号 = b.主键编号
);
评论(0)