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

Sql操作 - 删除数据库重复项

时间:2014-09-16 20:39:11      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:数据库   sql   

TableName : yourtablename

Existed Fields: yourfield1,yourfield2, handle.......


删除指定字段yourfield1为MatchedString所所有重复项


delete * from yourtablename where yourfield1='MatchedString' and handle not in (select distinct min(Handle) from chnl where yourfield1='MatchedString')



删除数据库中所有存在重复项的字段


delete * from yourtablename where handle not in (select distinct min(handle) from yourtablename group by  yourfield1)


Sql操作 - 删除数据库重复项

标签:数据库   sql   

原文地址:http://blog.csdn.net/vivitue/article/details/39322073

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