Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding duplicates in a field

Status
Not open for further replies.

AccountingTechie

Programmer
Feb 14, 2008
3
US
Hi all - there is a way to check for existing duplicates in a database using one of the fields (say street address, which of course is not going to be unique) using the word "having". How would you write that select query? Thanks
 
Like this...

Code:
Select StreetName
From   Address
Group By StreetName
Having Count(*) > 1

You can also add the count to the select list so you can see how many duplicates there are, like this...


Code:
Select StreetName, Count(*) As DuplicateCount
From   Address
Group By StreetName
Having Count(*) > 1

Make sense?


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top