Mysql 如何删除数据表中的重复数据!

时间:2014-06-13 06:03:20   收藏:0   阅读:492

1、使用distinct查询所有不重复的记录

2、创建数据表相同结构的临时表,将第一步的数据复制进去

    create temporary table if not exists student_temp as (select distinct(name), sex from student);

3、truncate table student;

4、insert into student(id,name,sex) select null,name,sex from student_temp;

 

 

Mysql 如何删除数据表中的重复数据!,布布扣,bubuko.com

原文:http://www.cnblogs.com/shibazi/p/3781226.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!