查看和删除不重复记录

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)

猜你喜欢

转载自blog.csdn.net/tg2003/article/details/6326952