您的位置:首页 > 数据库

转:SQL重复记录查询

2011-03-09 10:55 429 查看
select distinct * into #Temp from RepeatAll
drop table RepeatAll
select * into RepeatAll from #Temp
drop table #Temp

select identity(int,1,1) id,* into #Temp from RepeatAll
drop table RepeatAll
--select
select name,sex,address from #Temp group by name,sex,address having (count(*)>1)
--delete
delete from #Temp where id not in
(select min(id) id from #Temp group by name,sex,address)
select name,sex,address into RepeatAll from #Temp
drop table #Temp
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: