更新时间:2023-02-05 12:13:37
怎么样:
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
基本上,你只需将数据分组由感兴趣的栏目,并让SQL算的行匹配每个组列值。
Basically, you just group your data by the columns of interest, and let SQL count the rows that match each set of column values.