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

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

问题描述

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

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

从表中删除重复记录

推荐答案

我明白了!简单而且效果很好.

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天全站免登陆