Question : delete duplicate records

Ive got a table tblCustomer
Ive messed up my query  I managed to copy the same information into the table numerous times.

I should have just over 500 records but I now have over 2000 records.
When I try to just delete the records in SQL I get the following error.
The row value(s) updated either do not make the row unique or they alter multiple rows.
Basically its trying to delete every record.

There is no PK on the table.

Any ideas how to delete the duplicate records.

Answer : delete duplicate records

SELECT  color, size, type FROM `table`

                        color      size              type
                  blue              small      shirt
                  blue              medium      shirt
                  red              large      sweater
                  red              large      sweater
                  green      small      sweater
                  blue              small      shirt


SELECT distinct(concat(color,size,type)), color, size, type FROM `table`

(concat(color,size,type))      color      size      type
bluesmallshirt                              blue               small      shirt
bluemediumshirt                      blue              medium      shirt
redlargesweater                      red              large      sweater
greensmallsweater                      green      small      sweater

You provided no sample data so I made a small dataset to illustrate the problem you seem to be in. And whiel this doeesn't actually delete any records what it does do is give you the compete set of data with no more than one copy in the event two records duplicate. In the original data set there are 6 entries including 2 blue small shirts, and 2 red large sweaters, but the second line each is listed once. the easiest way to "delete" would be to import this query into a new blank database with the same structure as your original, then replace the data in the original with the copy.

Random Solutions  
 
programming4us programming4us