查看和删除不重复记录

uid为重复关键字

select * from TableName
where [uid] in (select [uid] from TableName group by [uid] having count([uid])>1) and id not in (select min(id) from TableName group by [uid] having count([uid])>1)

delete from TableName
where [uid] in (select [uid] from TableName group by [uid] having count([uid])>1) and id not in (select min(id) from TableName group by [uid] having count([uid])>1)

posted @ 2011-04-16 00:42  冷寒生  阅读(156)  评论(0)    收藏  举报
IT知识库