码迷,mamicode.com
首页 > 数据库 > 详细

SQL 删除表中重复记录只剩一条

时间:2017-06-23 13:01:17      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:class   delete   highlight   top   update   重复记录   color   xiaomi   date   

 

今天不小心插入数据时插入重复了

这表中没有任何主键外键,随便插入或删除

网上查了很多复杂的语句都没有解决问题

最后用delete top (1) 解决问题

delete top (1) from Persion where name = xiaomin


也可以用

update  top (1) from person where name =‘xxxx‘

delete from person where name = ‘xxxx‘

 

没那么复杂

 

SQL 删除表中重复记录只剩一条

标签:class   delete   highlight   top   update   重复记录   color   xiaomi   date   

原文地址:http://www.cnblogs.com/goldenyi/p/7069114.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!