Usually we check the weight, and filter the duplicates according to a certain condition.
SELECT * FROM dbo. T_ecert A
where (A.ecertid) in (select Ecertid from T_ecert GROUP by Ecertid+idcard have count (*) > 1)
But what if you need to have multiple conditions?
Oracle can do this
SELECT * FROM dbo. T_ecert A
where (A.ecertid,a.idcard) in (select A.ecertid,a.idcard from T_ecert GROUP by Ecertid,idcard have count (*) > 1)
This solves the multi-conditional query, but SQL Server 2008 is not possible, but I think of a way to do this
SELECT * FROM dbo. T_ecert A
where (A.ecertid+a.idcard) in (select A.ecertid+a.idcard from T_ecert GROUP by Ecertid+idcard have count (*) > 1)
Multiple conditions can be combined into a single column, different data stitching out the data must be different, so the multi-condition sieve weight may be solved
This article is from the "Data Domain" blog, so be sure to keep this source http://charlist.blog.51cto.com/1616209/1697482
SQL Server 2008 filters duplicate records by criteria