Title: duplicate entry related errors
Last modified: November 29, 2023

---

# duplicate entry related errors

 *  Resolved [Slim Karaaslan](https://wordpress.org/support/users/slimx91/)
 * (@slimx91)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/duplicate-entry-related-errors/)
 * hey so lately I’ve been having issues with our WooCommerce search. I’ve been 
   trying to REVERT MY KEYS. But I simply cannot.
 * Meta Upload ID: VvU4jhLL
 * I keep getting this error:
 * Duplicate entry ‘simple_history_db_version’ for key ‘option_name’
 * And now i have “Convert Keys” and “Revert Keys” as an option for wp_options :/
 * Could you please help 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [OllieJones](https://wordpress.org/support/users/olliejones/)
 * (@olliejones)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/duplicate-entry-related-errors/#post-17239627)
 * Sorry for the hassle.
 * It looks to me like your wp_options table has somehow gotten a duplicate name
   in it. There’s supposed to be a UNIQUE key (or a primary key) on the `option_name`
   column to prevent this.
 * You can get rid of the duplicates by putting this query into phpmyadmin or some
   other MySQL / MariaDB client.
 * `DELETE o`
    `FROM wp_options o JOIN ( SELECT option_name, MIN(option_id) option_id
   FROM wp_options GROUP BY option_name HAVING COUNT(*) > 1 ) dups ON o.option_name
   = dups.option_name WHERE o.option_id > dups.option_id
 * Then you should be able to convert or revert your keys.
 * Would you be kind enough to try uploading your metadata again? I don’t think 
   your upload went through.
    -  This reply was modified 2 years, 6 months ago by [OllieJones](https://wordpress.org/support/users/olliejones/).
 *  Thread Starter [Slim Karaaslan](https://wordpress.org/support/users/slimx91/)
 * (@slimx91)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/duplicate-entry-related-errors/#post-17241927)
 * hey when i run it i get an error unfortunately :(:
 * ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
   corresponds to your MariaDB server version for the right syntax to use near ‘
   o.option_id > dups.option_id’ at line 1
 *  Plugin Author [OllieJones](https://wordpress.org/support/users/olliejones/)
 * (@olliejones)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/duplicate-entry-related-errors/#post-17242519)
 * Maybe the way I showed the query on multiple lines somehow turned into copypasta
   on your setup. Here is the deduplicating SQL command as a single long line.
 *     ```wp-block-code
       DELETE o FROM wp_options o JOIN ( SELECT option_name, MIN(option_id) option_id FROM wp_options GROUP BY option_name HAVING COUNT(*) > 1) dups ON o.option_name = dups.option_name WHERE o.option_id > dups.option_id
       ```
   
 *  Thread Starter [Slim Karaaslan](https://wordpress.org/support/users/slimx91/)
 * (@slimx91)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/duplicate-entry-related-errors/#post-17242703)
 * I love the way you worded that lmao. 
   Dude you are a legend. Thank you so much.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘duplicate entry related errors’ is closed to new replies.

 * ![](https://ps.w.org/index-wp-mysql-for-speed/assets/icon-128x128.png?rev=2652667)
 * [Index WP MySQL For Speed](https://wordpress.org/plugins/index-wp-mysql-for-speed/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/index-wp-mysql-for-speed/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/index-wp-mysql-for-speed/)
 * [Active Topics](https://wordpress.org/support/plugin/index-wp-mysql-for-speed/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/index-wp-mysql-for-speed/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/index-wp-mysql-for-speed/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Slim Karaaslan](https://wordpress.org/support/users/slimx91/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/duplicate-entry-related-errors/#post-17242703)
 * Status: resolved