?
Solved

Find a duplicate field in 2 or more records

Posted on 2013-01-09
3
Medium Priority
?
557 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 41

Accepted Solution

by:
ralmada earned 2000 total points
ID: 38760739
this will give you one member per address

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

Expert Comment

by:awking00
ID: 38760861
What dbms are you using?
0
 

Author Comment

by:dmathews63
ID: 38762771
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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Suggested Courses

765 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