Delete duplicate values in Microsoft Access

30 pts.
Tags:
Database programming
Delete duplicates
Duplicate records
Microsoft Access
there was a ms access database in which there 3 to 4 values same so i want to delete the values keeping only one value. so i need a query.
ASKED: March 20, 2009  5:15 AM
UPDATED: March 25, 2009  2:26 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

delete * from TABLE1
where TABLE1.id in
(select tb1.id
from TABLE1 as tb1, TABLE1 as tb2
where tb1.columnA=tb2.columnA
And tb1.id>tb2.id)

this query will do the job, in case each record has an ID
i tested it before sending, no matter how many dupplication you have it will delete it
———————————-
1.
SELECT distinct * into tmp from YourTableWithDups
2.
Drop table YourTableWithDups
3.
Rename tmp –> YourTableWithDups

———————————-

1.
SELECT distinct * into tmp from YourTableWithDups
2.
use delete command for all duplicate records —-> Commit
3.
select * into YourTableWithDups from tmp

escape Duplication use primary key or unique key for future.

Thank You

-SatishJain

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following