数据库中删除重复记录的一种简单的方法

来源:互联网 发布:淘宝贷款被骗的群 编辑:程序博客网 时间:2024/05/15 03:51

数据库中删除重复记录的一种简单方法

假设存在如下数据表

 
 create table Custom       {          CusNo int incremental,          CusName nvarchar(50)       }     

现在想要删除其中CusName重复的记录,可以采用如下的sql语句:


 
delete Custom where CusNo not in       (select max(CusNo) from Custom group by CusName)      

原创粉丝点击