mySQL Delete all duplicate records in sql with same id code example
Example 1: mysql remove duplicates
DELETE FROM table_name WHERE id
NOT IN ( SELECT id FROM table_name
GROUP BY field_1, field_2)
Example 2: delete all duplicate rows keep the latest except for one in mysql
DELETE
FROM
`tbl_job_title`
WHERE id NOT IN
(SELECT
*
FROM
(SELECT
MAX(id)
FROM
`tbl_job_title`
GROUP BY NAME) tbl)