Removing duplicate records

Results 1 to 3 of 3

Thread: Removing duplicate records

  1. #1
    cinD Guest

    Default Removing duplicate records

    Without the luxury of an identity field, is there a way to delete a duplicate record while leaving the other(s) alone? To force simplicity, assume my horribly planned table has a single field called "Name." Let&#039s say there are three records in the table that have the value "Joe." Is there a practical way to delete the second and third Joe? I obviously can&#039t say "DELETE FROM Table WHERE Name = &#039Joe&#039". Furthermore, is there a way I can construct a query to sweep the whole table in one action and automatically delete the second, third,... occurrences or am I asking too much??<BR><BR>: )

  2. #2
    Join Date
    Dec 1969

    Default RE: Removing duplicate records

    What&#039s wrong with having more than 1 Joe?<BR>Create a NAME_temp table. Insert only distinct name values to the new table. Dump your original table, then copy back the values from the temp table to your (empty)original table, no dup&#039s.

  3. #3
    Join Date
    Dec 1969

    Default RE: Removing duplicate records

    If your horribly designed table does not have a primary key there is no way using only SQL to delete duplicate entries. the database hase no way of uniquely identifying records ... so you could write a script that would loop thru the table and programatically delete the duplicates ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts