Hi,
Let's assume i have employee table which has the following 4 columns
id (primary key) - auto generated
name
father_name
mother_name
Assume the following table as input
id | name | father_name | mother_name |
---|
1 | Isaac | Abraham | Sarah |
2 | Jacob | Isaac | Rebecca |
3 | Joseph | Jacob | Rachel |
4 | Benjamin | Jacob | Rachel |
Assume many duplicate records exist with same name, father name and mother name
Case1: I want to remove all the records except the first inserted record group by name, father name, mother name
Case2: I want to remove all the records except the last inserted record group by name, father name, mother name
Case3: I want to remove all the duplicate records
I'm using mysql. Please advise how to write a delete query for the above 3 cases
Is the following is correct ???
Case1: Keep Latest i.e Highest Id
Case2: Keep Oldest i.e Lowest id
Case3:
Thanks.