在sqlserver表中查找dulicates [英] find dulicates in the sqlserver table
本文介绍了在sqlserver表中查找dulicates的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hai朋友,
我在sqlserver中有表,在它们的出口重复项中,
我的要求是找到重复项并在另一列中指定.
brifly
如果第一列中有重复项,则在第一列中存在,如果第1列中有重复项,则该列旁边没有重复项显示0
="code-keyword">选择 FIELDNAME,大小写 count(FIELDNAME)何时 1 然后 0 1 as 复制
来自表名
组 by FIELDNAME
这是实现您所要求的一种简单方法,但是是否要取决于您自己呢!
检查以下文章,其中包含许多示例:
http://support.microsoft.com/kb/139444 [ http://blog.sqlauthority.com/2007/03/01 /sql-server-delete-duplicate-records-rows/ [ 解决方案
select FIELDNAME, case count(FIELDNAME) when 1 then 0 else 1 end as Duplicate from TABLENAME group by FIELDNAME
This is a simple way to achieve what you have asked, but whether it''s what you want or not is up to you!!
check the following articles which has many examples:
http://support.microsoft.com/kb/139444[^]
http://blog.sqlauthority.com/2007/03/01/sql-server-delete-duplicate-records-rows/[^]
这篇关于在sqlserver表中查找dulicates的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文