有兩個意義上的重復記錄
select distinct * from tableName
就可以得到無重復記錄的結果集
如果該表需要刪除重復的記錄(重復記錄保留
select distinct * into #Tmp from tableName
drop table tableName
select * into tableName from #Tmp
drop table #Tmp
發生這種重復的原因是表設計不周產生的
假設有重復的字段為Name
select identity(int
select min(autoID) as autoID into #Tmp
select * from #Tmp where autoID in(select autoID from #tmp
最後一個select即得到了Name
From:http://tw.wingwit.com/Article/program/ASP/201311/21718.html