怎么样:
SELECT COUNT(*), A, B, C, D
FROM dbo.YourTable
GROUP BY A, B, C, D
-- optional - if you want to skip all the rows that occur only once
-- HAVING COUNT(*) > 1
Run Code Online (Sandbox Code Playgroud)
基本上,您只需按感兴趣的列对数据进行分组,并让SQL计算与每组列值匹配的行.