select * into #tmp from trvperson group by id,parentID,tableName,url,target,expanded having count(id)>1delete trvperson where id in(select id from #tmp)insert into trvpersonselect * from #tmpdrop table #tmp