mysql删除重复记录
2015-02-07 21:34
435 查看
Solution 1:
Add Unique Index on your table:
Solution 2:
Add primry key in your table then you can easily remove duplicates from your table using below query:
Solution 3:
ref:
http://stackoverflow.com/questions/3311903/remove-duplicate-rows-in-mysql http://stackoverflow.com/questions/4685173/delete-all-duplicate-rows-except-for-one-in-mysql http://stackoverflow.com/questions/14046355/how-do-i-delete-all-the-duplicate-records-in-a-mysql-table-without-temp-tables http://www.databasejournal.com/features/mysql/article.php/10897_2201621_2/Deleting-Duplicate-Rows-in-a-MySQL-Database.htm
Add Unique Index on your table:
ALTER IGNORE TABLE `TableA` ADD UNIQUE INDEX (`member_id`, `quiz_num`, `question_num`, `answer_num`);
Solution 2:
Add primry key in your table then you can easily remove duplicates from your table using below query:
DELETE FROM member WHERE id IN (SELECT * FROM (SELECT id FROM member GROUP BY member_id, quiz_num, question_num, answer_num HAVING (COUNT(*) > 1) ) AS A );
Solution 3:
SELECT DISTINCT * INTO TableA_Verify FROM TableA; DROP TABLE TableA; RENAME TABLE TableA_Verify TO TableA;
ref:
http://stackoverflow.com/questions/3311903/remove-duplicate-rows-in-mysql http://stackoverflow.com/questions/4685173/delete-all-duplicate-rows-except-for-one-in-mysql http://stackoverflow.com/questions/14046355/how-do-i-delete-all-the-duplicate-records-in-a-mysql-table-without-temp-tables http://www.databasejournal.com/features/mysql/article.php/10897_2201621_2/Deleting-Duplicate-Rows-in-a-MySQL-Database.htm
相关文章推荐
- mysql 删除表中的重复记录,只保留其中一条
- MYSQL中删除重复记录的方法
- mysql删除重复记录语句的方法
- MySql删除重复的记录
- mysql删除重复记录,保留id最少
- MySQL 删除表中重复的记录(where......)
- MYSQL 删除同一表中重复记录
- MYSQL删除某个字段多余重复记录
- mysql删除重复记录语句的方法
- 删除MySQL表的重复记录
- MySQL查询及删除重复记录的方法
- MySQL重复记录 查询及删除
- mysql删除重复记录
- mysql,oracle里删除重复记录,只保留一条(除了自增长字段,其他的字段完全相同为相同记录)
- MYSQL中删除重复记录的方法
- MySQL查询及删除重复记录的方法
- MYSQL删除重复记录(此处有正解)
- MySQL语句删除数据库重复记录数据行
- MySQL查询及删除重复记录的方法
- 删除mysql重复记录的办法