Title: Database Syntax Errors
Last modified: June 17, 2025

---

# Database Syntax Errors

 *  [ljmac](https://wordpress.org/support/users/ljmac/)
 * (@ljmac)
 * [9 months, 4 weeks ago](https://wordpress.org/support/topic/database-syntax-errors-2/)
 * I originally reported this years ago with version 3.1, but upon trying the plugin
   again I have found these errors remain (also after upgrading my server). I am
   getting database syntax errors in relation to your orphaned term meta cleanup–
   see the following:
 * When I go to the General clean-up panel in the plugin settings:
 * `WordPress database error 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'
   WHERE term_id NOT IN (SELECT term_id FROM as_terms)' at line 1 for query SELECT
   COUNT(meta_id) FROM WHERE term_id NOT IN (SELECT term_id FROM as_terms) made 
   by require_once('wp-admin/admin.php'), do_action('tools_page_advanced_db_cleaner'),
   call_user_func_array, ADBC_Advanced_DB_Cleaner->aDBc_main_page_callback, include_once('/
   plugins/advanced-database-cleaner/includes/clean_db.php'), include_once('/plugins/
   advanced-database-cleaner/includes/class_general_cleanup.php'), ADBC_Clean_DB_List-
   >__construct, ADBC_Clean_DB_List->aDBc_prepare_elements_to_clean, aDBc_count_all_elements_to_clean,
   aDBc_count_elements_to_clean"`
 * When I do a manual cleanup with orphaned term meta enabled:
 * `WordPress database error 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'
   WHERE term_id NOT IN (SELECT term_id FROM as_terms)' at line 1 for query DELETE
   FROM WHERE term_id NOT IN (SELECT term_id FROM as_terms) made by require_once('
   wp-admin/admin.php'), do_action('tools_page_advanced_db_cleaner'), call_user_func_array,
   ADBC_Advanced_DB_Cleaner->aDBc_main_page_callback, include_once('/plugins/advanced-
   database-cleaner/includes/clean_db.php'), include_once('/plugins/advanced-database-
   cleaner/includes/class_general_cleanup.php'), ADBC_Clean_DB_List->__construct,
   ADBC_Clean_DB_List->aDBc_prepare_elements_to_clean, ADBC_Clean_DB_List->process_bulk_action,
   aDBc_clean_all_elements_type, aDBc_clean_elements_type"`
 * When I do a scheduled cleanup with orphaned term meta enabled:
 * `WordPress database error 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'
   WHERE term_id NOT IN (SELECT term_id FROM as_terms)' at line 1 for query DELETE
   FROM WHERE term_id NOT IN (SELECT term_id FROM as_terms) made by do_action_ref_array,
   call_user_func_array, aDBc_clean_scheduled_elements, aDBc_clean_elements_type"`
 * As you can see I have a non-standard database prefix – I don’t know if this has
   anything to do with it. I really hope you can fix this, as your plugin is clearly
   the best of its type.

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

 *  Plugin Author [Younes JFR.](https://wordpress.org/support/users/symptote/)
 * (@symptote)
 * [9 months, 2 weeks ago](https://wordpress.org/support/topic/database-syntax-errors-2/#post-18529907)
 * Hi [@ljmac](https://wordpress.org/support/users/ljmac/),
 * I’ve thoroughly tested the plugin but haven’t been able to reproduce these errors.
 * Could you please contact me via email with more details? You can reach me here:
   [https://sigmaplugin.com/contact](https://sigmaplugin.com/contact)
 * Kind regards,
   Younes
 *  Thread Starter [ljmac](https://wordpress.org/support/users/ljmac/)
 * (@ljmac)
 * [9 months, 2 weeks ago](https://wordpress.org/support/topic/database-syntax-errors-2/#post-18529921)
 * Hi Younes,
 * Thanks for getting back to me – I just emailed you.

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

The topic ‘Database Syntax Errors’ is closed to new replies.

 * ![](https://ps.w.org/advanced-database-cleaner/assets/icon-256x256.png?rev=3405580)
 * [Advanced Database Cleaner – Optimize & Clean Database to Speed Up Site Performance](https://wordpress.org/plugins/advanced-database-cleaner/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-database-cleaner/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-database-cleaner/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-database-cleaner/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-database-cleaner/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-database-cleaner/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [ljmac](https://wordpress.org/support/users/ljmac/)
 * Last activity: [9 months, 2 weeks ago](https://wordpress.org/support/topic/database-syntax-errors-2/#post-18529921)
 * Status: not resolved