Delete duplicate rows from a table


/ Published in: SQL
Save to your folder(s)

this will delete where uniqueField is greater


Copy this code and paste it in your HTML
  1. DELETE T1
  2. FROM MyTable T1, MyTable T2
  3. WHERE T1.dupField = T2.dupField
  4. AND T1.uniqueField > T2.uniqueField

URL: http://www.cryer.co.uk/brian/sql/sql_delete_duplicates.htm

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.