Mik0r
Mik0r

Reputation: 201

How can I remove duplicate records in Access only if all fields match?

I have a table that unfortunately has many duplicates. Here is a small example:

Name | Location
Mike | New Jersey
Mike | Ohio
Brian | Ohio
Mike | New Jersey

How can I only remove dups on the Mike | New Jersey lines? I'm having trouble making sure all fields match and not just Name. So my end result would be:

Name | Location
Mike | New Jersey
Mike | Ohio
Brian | Ohio

Upvotes: 0

Views: 3313

Answers (1)

Shamit Verma
Shamit Verma

Reputation: 3827

Easier to do that in two steps:

  1. Create a table without duplicates
  2. Truncate original table and load data from table you just created

To create a Query that will remove duplicates, use Group By. E.g.

SELECT Name,Location
FROM TABLE_NAME
GROUP BY Name,Location

Upvotes: 4

Related Questions