$dupq = mysql_query("SELECT * FROM `db`"); $dups = mysql_fetch_array($dupq); foreach($dups as $dup){ mysql_query("DELETE FROM db WHERE duplicate_COLUMN='".$dup['duplicate_column']."' AND id!='".$dup['id']."'"); }
duplicate_COLUMN – Name of column and $dup[‘column_name’] delete duplicates which include same column data.