首页 > 代码库 > Sql操作 - 删除数据库重复项

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操作 - 删除数据库重复项