php - Delete double rows in MySQL table when columns have identical entries -
this question has answer here:
- remove duplicates using mysql query? 7 answers
i have database table (test_table) auto-increment column (id) , want delete double (or more) entries when 3 specific columns (a, b, c) have identical entries.
id column_a column_b column_c ------------------------------------------------ 1 ooo aaa uuu 2 ooo aaa uuu 3 ttt ppp uuu 4 ooo aaa uuu 5 iii kkk ccc
in example, rows id 2 , 4 should deleted after executing delete query.
regards.
delete tbl `id` not in ( select * ( select min(`id`) tbl group `column_a` , `column_b` , `column_c` ) x )
Comments
Post a Comment