u/unconfirmedikea

Deleting duplicates with more than 10 fields (and long text)

I have a table that I need to delete duplicates from. The number of fields that need to be checked is way more than 10 and includes 2 long-text fields. To start, I used a select query to concatenate all the data that needs to be checked for duplication into one long-text field and then used a make table query to split each of those concatenated fields into 255-character chunks (which, thankfully, is under 10 chunks). Then I used the Query Wizard to do a find duplicates query for those chunks. Because I’m only looking for truly exact duplicates in terms of the combination of those fields, this seems to do the trick.

What I’m struggling with now is figuring out how to accurately delete the duplicates from the original table now that I’ve identified them. My original table has an auto-number field that I also carried through all the steps to the find duplicates query (just as a reference—I didn’t check that field for duplicates, obviously). So the idea was to populate a delete query with the auto-numbers of all of the duplicate values. However, I can’t figure out how to parse the duplicate wizard query to just select the auto-numbers for the 2^(nd), 3^(rd), 4^(th), etc. instances of duplicates and ignore the first instance. I feel like there should be a simple answer to this, but I can’t figure it out.

I can provide code for any of the existing queries if requested.

Thanks!

reddit.com
u/unconfirmedikea — 12 days ago