【Vegas原创】查找删除重复键的数据

阅读 195

2022-09-09

--查找重复的Custno列的数据
SELECT * FROM SCM_Customer
WHERE   Custno IN
  (SELECT  Custno
    FROM  SCM_Customer
    GROUP BY Custno
    HAVING  (COUNT(Custno) > 1))

--删除重复的Custno列的数据
delete SCM_Customer 
where custno in
(SELECT Custno
    FROM  SCM_Customer
    GROUP BY Custno
    HAVING  (COUNT(Custno) > 1))

 



精彩评论(0)

0 0 举报