Skip to content
Advertisement

Query to delete duplicate records from MS Access

I have a table with multiple duplicate records. I’m using MS Access. I would like to delete duplicate records using a query. This is the table sample:

ID        | Holiday
----------+------------------
1234      | 1
1234      | 1
2345      | 2
2345      | 2
5678      | 5

I want my query result to be:

ID        | Holiday
----------+------------------
1234      | 1
2345      | 2
5678      | 5

Is here any way to do this in MS Access? Perhaps using SQL? I tried using query wizard but it only gives me list of duplicate records. Your help is greatly appreciated. Thank you

Advertisement

Answer

Since your data does not include a primary key by which the data can be ordered, the easiest way to yield a unique data set would be to use a select into query to generate a new table, e.g.:

select distinct * into NewTable from YourTable

You can then optionally delete your original table using:

drop table YourTable
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement