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?
dmathews63Asked:
Who is Participating?
 
ralmadaCommented:
this will give you one member per address

select Address, max(memberID)
from yourtable
group by Address
0
 
awking00Commented:
What dbms are you using?
0
 
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,
Dick
0
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.

All Courses

From novice to tech pro — start learning today.