I have a MySQL table and I want to find and delete rows which two columns have replicated values.
For example:
|ID|Name|Address|Birth_Date|
---------------------------
|1 | ab | abc |1990-05-24|
|2 | cd | def |1980-06-30|
|3 | ab | xyz |1990-05-24|
Here are two rows with ID
1 and 3 that refer to the same person. These rows share same Name
and same Birth_Date
values and may differ from one or more attributes, then they are not duplicates.
How can I find and delete these rows preserve only one of these (the first occurrence or the second occurrence)?
I want that the resulting table is the same table with only one occurrence of those rows preserved:
|ID|Name|Address|Birth_Date|
---------------------------
|1 | ab | abc |1990-05-24|
|2 | cd | def |1980-06-30|