P粉7764125972023-08-26 00:32:58
In your delete statement, you used the limit 1
option, which means you will only delete one record.
Try fixing your code like this:
DELETE FROM wp_options WHERE option_id=5 limit (dupl_rec_count - 1);
P粉6210339282023-08-26 00:15:25
You can use this method to keep the row with the lowest id value
DELETE e1 FROM contacts e1, contacts e2 WHERE e1.id > e2.id AND e1.email = e2.email;
This is a sample link Link 1
Or you can change >
to <
to keep the highest id
DELETE e1 FROM contacts e1, contacts e2 WHERE e1.id < e2.id AND e1.email = e2.email;
This is a sample link Link 2