Home > Database > Mysql Tutorial > 删除mysql数据库中的重复数据记录

删除mysql数据库中的重复数据记录

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 18:00:30
Original
775 people have browsed it

mysql中select distinct * from text不能显示不重复的记录,而是直接全部显示

采用的是下面的方法可删除,假设重复的是test数据库中的title字段
代码如下:
create table bak as (select * from test group by title having count(*)=1);
insert into bak (select * from test group by title having count(*)>1);
truncate table test;
insert into test select * from bak;
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template