• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 567
  • Last Modified:

Find a duplicate field in 2 or more records

What I have is a database of club members. There may be more than one member at the same household address. There are times when I want to send a mailing to only one member of the household instead of all.

The field in this case is Address. I want my result set to only include one member at that Address to receive the mailing. It does not have to be a specific member. I need the first occurrence and ignore the rest at that Address.

I am looking for a SQL statement that can give the results I want. I tried Distinct, but that applies to the row, not a single field. I believe that is true. Group By does not seem to work either.

Anyone know how to do this?
1 Solution
this will give you one member per address

select Address, max(memberID)
from yourtable
group by Address
What dbms are you using?
dmathews63Author Commented:
The post by ralmada gave me what I needed. I was trying something similar, but was missing something. This solution appears to be doing what I want.

Thanks everyone,
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now