littleiitin
11-19-2011, 10:04 PM
'============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
Delete * from Table2
2: Find First Records of duplicate records and insert these into temp Table2
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
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
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
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
Delete * from Table2
2: Find First Records of duplicate records and insert these into temp Table2
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
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
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