---
title: "一条语句，删除mysql表的重复数据"
author: "liomao"
date: "2010-05-21T19:47:23Z"
tags: ["MySQL"]
categories: ["数据库"]
slug: "mysql"
draft: false
lastmod: "2010-05-21T19:47:23Z"
id: 672037
url: "https://liomao.iteye.com/blog/672037"
---

在网上看到的，觉得有必要记录下。

 

```
delete students as a from students as a,
(select * from students group by name having count(1)>1) as b
where a.name=b.name and a.id > b.id;
```

 

达到了效果，就不知道效率如何。如果有更加好的方法，请赐教，不胜感激！