Hussein Al-Obaidy
Hussein Al-Obaidy

Reputation: 58

Find Duplicate in Two Columns in sql server

I have a table that contain two column PropertyID and DistrictID what I need is to find duplicate that match each PropertyID and DistrictID. I mean each PropertyID and DistrictID repeated together. please any help well be appreciated.

Upvotes: 1

Views: 99

Answers (1)

Tim Schmelter
Tim Schmelter

Reputation: 460108

You have to group by these columns:

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

Upvotes: 4

Related Questions