Home > Database > Mysql Tutorial > 删除重复记录的sql语句

删除重复记录的sql语句

WBOY
Release: 2016-06-07 17:47:40
Original
1337 people have browsed it

删除重复记录的sql语句我们提供了两款删除重复记录的sql语句,一种是用id not in来实例,也算是联合查询的方法吧,第二种是临时表来删除重复记录。

删除重复记录的sql语句
我们提供了两款删除重复记录的sql语句,一种是用id not in来实例,也算是联合查询的方法吧,第二种是临时表来删除重复记录。

1),delete from tablename where id not in (select max(id) from tablename group by col1,col2,...)

 

2),select distinct * into temp from tablename
  delete from tablename
  insert into tablename select * from temp
Related labels:
source:php.cn
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