Showing posts with label access. Show all posts
Showing posts with label access. Show all posts

Thursday, 16 September 2010

Find and Delete duplicate records

Find and Delete duplicate records


Find Duplicate Records using SQL


       SELECT name, COUNT(name) AS namecount
       FROM tbl_content
       GROUP BY name
       HAVING ( COUNT(name) > 1) 

Delete Duplicate Records using SQL


       delete T1 from tbl_content T1, tbl_content T2 where T1.name = T2.name and T1.id > T2.id 

Delete Duplicate Records using Access


      delete from
      MyTable
      where uniqueField not in
      (select min(uniqueField) from
      MyTable T2
      where T2.dupField=MyTable.dupField)