删除重复的SQL记录 [英] Delete Duplicate SQL Records

查看:104
本文介绍了删除重复的SQL记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在表中删除具有重复名称的记录的最简单方法是什么?我遇到的答案很混乱。



相关:




从表格中删除重复的记录



解决方案

我知道了!

 删除
t1

tTable t1,tTable t2
其中
t1.locationName = t2.locationName和
t1.id> t2.id

http://www.cryer.co.uk/brian/sql/sql_delete_duplicates.htm


What is the simplest way to delete records with duplicate name in a table? The answers I came across are very confusing.

Related:

Removing duplicate records from table

解决方案

I got it! Simple and it worked great.

delete 
   t1 
from 
   tTable t1, tTable t2 
where 
   t1.locationName = t2.locationName and  
   t1.id > t2.id 

http://www.cryer.co.uk/brian/sql/sql_delete_duplicates.htm

这篇关于删除重复的SQL记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆