2014-09-03 35 views
1

我有一個包含兩個列PropertyID和DistrictID 的表我需要的是找到與每個PropertyID和DistrictID匹配的重複項。 我的意思是每個PropertyID和DistrictID重複在一起。 請任何幫助,不勝感激。在sql server中查找重複的兩列

回答

4

你必須按這些列:

SELECT PropertyID, DistrictID 
FROM dbo.TableName 
GROUP BY PropertyID, DistrictID 
HAVING COUNT(*) > 1 
+0

該死的打我吧... – Tristan 2014-09-03 08:45:19

+0

感謝很多的工作。 – 2014-09-03 08:49:46