Hello-I'm trying to write a sproc that will give me the identity field of a row where two of the fields are identical (name in this case).I've seen the article about selecting duplicate records, so that isn't a problem. select contactFirstName, contactLastName, count(*)from tblContacts group by contactFirstName, contactLastNamehaving count(*) > 1order by count(*) desc, contactFirstName, contactLastName
It would be nice if there was a way for me to also get the identity field for any of these duplicates. I'm thinking that I can't do it within this statement because grouping by an identity field will automatically mean that I get nothing with a count(*) greater than 1.Is there a way to do this by using this SQL statement as a sub-select or perhaps joining it so that I can get all of the contactID's? Thanks in advance.