Delete duplicate values in Microsoft Access
30 pts.
0
Q:
Delete duplicate values in 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: Mar 20 2009  5:15 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
29820 pts.
0
A:
 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0
  • AddThis Social Bookmark Button
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
Last Answered: Mar 25 2009  2:26 PM GMT by Carlosdl   29820 pts.
Latest Contributors: SatishJain   50 pts., Msi77   800 pts., Sous   580 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0