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)

Comments

Popular posts from this blog

Google to FTS Syntax Cheat Sheet

@@rowcount

Sql Index