Excluding duplicate records in query

R

Roman B.

I have a table with about 300,000 records. Many are duplicates. I'm trying to
create a make-table query to get only 1 copy of each record while ignoring
the duplicate records.
Does anyone know how I can do this?

For example I have one column in the table that has phone numbers, is there
a wayt o only get the first record that has the phone number while ignoring
all the other records that have the same phone number?
 
K

KARL DEWEY

A fast way if all fields are duplicated is to do a totals query and Group By
all columns.
 
J

John Spencer

I think that would only eliminate duplicates where all the fields were
equal.

Perhaps,

Group By the phone number and use FIRST on all the other fields. That won't
necessarily get the first record that has the phone number, but it will get
on of the records.

Another method is to build the table structure and set a unique index on the
phone number. Then do an insert into the built table. You will get an
error saying that ## records could not be added due to conflict in the
index. However, the query will insert one record with each phone number.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top