Link to home
Start Free TrialLog in
Avatar of tahirih
tahirih

asked on

Access - Deduplicate on multiple fields

I have attempted to use a SELECT DISTINCT query on, de-duplicating on three fields, without success.

I have a table, with the following three fields:

Favorite_Shoe        Last_Name     First_Name

I want to de-cuplicate records, based on unique values of all three fields, using a SQL DISTINCT query

Thanks
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

try

select distinct [Favorite_Shoe] & [Last_Name] & [First_Name], Favorite_Shoe, Last_Name,First_Name
from tableX
Avatar of tahirih
tahirih

ASKER

I get an extra [Expression Column]

I am also comparing these results with a De-Duplicate in Excel, and am not getting the same results.

Please advise, and how to not include the [Expression]

Thanks
Avatar of tahirih

ASKER

Additionally, I would like to include additional fields in the table other than the thre De-Dup fields.

Thanks
Avatar of tahirih

ASKER

Is there a ways to obtain Distinct Records based on the columns above, but if there are additional columns, include them in the output table?

For instance, my table has 5 columns, 3 of which will be included in the "DISTINCT" SQL programming. The solution may be the proper placement of an *, but all attempts I have made have not been successful.

Thanks.
what happen when you add the other fields

select distinct [Favorite_Shoe] & [Last_Name] & [First_Name], Favorite_Shoe, Last_Name,First_Name,Field4,field5
from tableX

Avatar of tahirih

ASKER

I continue to get unwanted "Expr" fields. The Query inlcludes the non-dedup fields (i.e Field4 or Field5) as part of what is being used in De-Duplication.

Thanks
tahirih,
attach your db.

check Attach File below. if db >4 mb. zipped it
Avatar of tahirih

ASKER

File attached, with a few notes.

Thanks
Sample-DeDup.xls
what do you want to do with the duplicates?
does your Access table have a unique recordID?
Avatar of tahirih

ASKER

At this time, I am not interested in keeping the duplicates. However, if you have a SQL coding method to export the duplicates into a new table, this is appreciated.

No, there is not a RecordID.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tahirih

ASKER

I thank you for this.

I did come across this link myself. However, I am particular on obtaining SQL code.