Solved

Find a duplicate field in 2 or more records

Posted on 2013-01-09
3
512 Views
Last Modified: 2013-01-10
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?
0
Comment
Question by:dmathews63
3 Comments
 
LVL 41

Accepted Solution

by:
ralmada earned 500 total points
Comment Utility
this will give you one member per address

select Address, max(memberID)
from yourtable
group by Address
0
 
LVL 31

Expert Comment

by:awking00
Comment Utility
What dbms are you using?
0
 

Author Comment

by:dmathews63
Comment Utility
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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now