Delete Duplicate Records from Access Table
'============In Access it requires 4 steps =========================================
If I have to remove Duplicate records from Table1
Table1 with column Names(let say Name and Age)
Needs a Temp Table Table2 with same No. columns, different Names( let say Name1,Age1)
1: Clear Temp Table
Code:
Delete * from Table2
2: Find First Records of duplicate records and insert these into temp Table2
Code:
Insert into Table2 Select First(Name) as Name1, First(Age) as Age1 FROM Table1 GROUP BY Name HAVING
Count(Name)>1
3: Delete all duplicate Records from Main Table Table1
Code:
Delete * from Table1 where Name in (Select First(Name) as Name1 FROM Table1 GROUP BY Name HAVING
Count(Name)>1)
4: Insert all Records of Temp Table into Main Table
Code:
Insert into Table1 select Name1 as Name,age1 as Age from Table2
If anyone has better way to delete please post your answer.
Thanks
Rahul
Delete Double Entry From Access DBF Table
Suppose we have Table1 as:
ID Name Address
1 col1 asdfhj
2 col2 dfskj
3 col3 dfgksdlkfg
4 col1 dfgsjk
We need to Delete duplicate records from this table where name should be unique then use this query
select * into Check from Table1 where name in
(
Select name from
(
SELECT Table1.Name, Count(Table1.Name) AS CountOfName
FROM Table1
GROUP BY Table1.Name
) where countofName=1)
this will create a check table with unique records.
Thanks....do reply.....if it was helpful............