Solution 1:

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删除重复记录的更多相关文章

  1. mysql 删除重复记录语句

    mysql 根据条件删除重复记录 只保留最小id的重复数据 DELETEFROM newsWHERE news_id IN ( SELECT a.news_id FROM ( SELECT news_ ...

  2. Mysql删除重复记录,保留id最小的一条

    mysql 查询重复字段,及删除重复记录的方法MySQL, 数据库, 数据库, 字段, 服务器数据库中有个大表,需要查找其中的名字有重复的记录id,以便比较.如果仅仅是查找数据库中name不重复的字段 ...

  3. mysql删除重复记录语句的方法

    例如: id name value 1 a pp 2 a pp 3 b iii 4 b pp 5 b pp 6 c pp 7 c pp 8 c iii id是主键 要求得到这样的结果 id name ...

  4. MySQL删除重复记录只保留一条

    删除表中重复记录,只保留一条: delete from 表名 where 字段ID in (select * from (select max(字段ID) from 表名 group by 重复的字段 ...

  5. mysql删除重复记录,只保留最大ID的记录(非重复也保留)

    目前网上搜索的删除重复记录,大部分都是where子查询,本人感觉看上去不美观,故亲自手写了一个,如下: delete from mst_sku using mst_sku,(  select dist ...

  6. MySQL删除重复记录的方法

    参考网上的方法,总结了产出重复记录的方法,欢迎交流. 参考:http://www.cnblogs.com/nzbbody/p/4470638.html 方法1:创建一个新表临时储存数据 假设我们有一个 ...

  7. mysql删除重复记录语句,删除除了 id 号不同,其他都相同的学生冗余信息

    /** 在Mysql下执行: delete from my.stu where id not in( select min(id) id from my.stu group by code) ; 用途 ...

  8. mysql删除重复记录,保存Id最小的一条

    方法1:1.创建一个临时表,选取需要的数据.2.清空原表.3.临时表数据导入到原表.4.删除临时表.mysql> select * from student;+----+------+| ID ...

  9. Mysql 删除重复记录,只保留最小的一条

    delete from `jb_postcontent` where id not in(select min(id) from (select * from `jb_postcontent`) as ...

  10. MySQL 删除重复记录

    ==========A really easy way to do this is to add a UNIQUE index on the 3 columns. When you write the ...

随机推荐

  1. 如何顺利解决mac下命令不管用的情况

    背景: 昨晚通过brew安装了node,结果导致我的终端除了cd和ls管用外,其他的命令都不管用了,网上搜索了一大堆,结果没有一个能正确解决我的问题的,记录一下吧. 打开终端就显示: -bash: t ...

  2. SQL Server 阻止了对组件“Ad Hoc Distributed Queries”的 STATEMENT“OpenRowset/OpenDatasource”的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用“Ad Hoc Distributed Queries”。有关启用“Ad Hoc Distributed Queries”

    1.开启Ad Hoc Distributed Queries组件,在sql查询编辑器中执行如下语句: exec sp_configure reconfigure exec sp_configure r ...

  3. jmeter通过json extrcator或者正则表达式获取json返回信息

    1.下载地址,及插件文档资料 https://jmeter-plugins.org/wiki/JSONPathExtractor/ json信息如下 { "error_code": ...

  4. 进程通信(socket)

    “一切皆Socket!” 话虽些许夸张,但是事实也是,现在的网络编程几乎都是用的socket. ——有感于实际编程和开源项目研究. 我们深谙信息交流的价值,那网络中进程之间如何通信,如我们每天打开浏览 ...

  5. poj2528

    Mayor's posters Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 56864   Accepted: 16445 ...

  6. using 关键字的使用

    using 关键字的使用主要分为两种类型:using declaration(using 声明)和using directive(using 命令): using 声明:引入特定名称空间中的一个成员. ...

  7. jQuery 文档操作方法(append)

    这些方法对于 XML 文档和 HTML 文档均是适用的,除了:html(). 一.append() 方法 append() 方法在被选元素的结尾(仍然在内部)插入指定内容. 例子: <html& ...

  8. 【题解】CF611H New Year and Forgotten Tree

    [题解]CF611H New Year and Forgotten Tree 神题了... 题目描述 给定你一棵树,可是每个节点上的编号看不清了,只能辨别它的长度.现在用问号的个数代表每个节点编号那个 ...

  9. python函数回顾:dict()

    描述 dict() 函数用于创建一个字典. 语法 dict 语法: class dict(**kwarg) class dict(mapping, **kwarg) class dict(iterab ...

  10. elementUI增加同级下级

    <template> <div> <el-row> <el-col :span="4"> <el-button v-on:cl ...