删除表的重复记录

  如果记录完全相同才算重复记录,那么:  (sql server2000下测试通过)

select distinct * into #tmpp from tid
delete from tid    
insert into tid select * from #tmpp
drop table #tmpp

  如果有id主键(数字,自增1的那种),那么:(sql server2000下测试通过)

delete from tableA where id not in
(select id = min(id) from tableA group by name)

你可能感兴趣的:(web)