摘要: 查询及删除重复记录的SQL语句1、查找表中多余的重复记录,重复记录是根据单个字段(Id)来判断 select * from 表 where Id in (select Id from 表 group byId having count(Id) > 1)2、删除表中多余的重复记录,重复记录是根据单个字段(Id)来判断,只留有rowid最小的记录DELETE from 表 WHERE (id) IN ( SELECT id FROM 表 GROUP BY id HAVING COUNT(id) > 1) AND ROWID NOT IN (SELECT MIN(ROWID) FROM 阅读全文
posted @ 2013-06-13 16:38 金虹巴巴 阅读(178) 评论(0) 推荐(0) 编辑