`

sql查询,删除重复记录

SQL 
阅读更多

查询:SELECT *
FROM tb_Customer
WHERE (CustomerName IN
(SELECT customername
FROM tb_Customer
GROUP BY customername
HAVING (COUNT(*)) > 1))
ORDER BY CustomerName

删除:select distinct * into #table_name from table_name
delete from table_name
select * into table_name from #table_name
drop table #table_name

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics