{"id":18516089,"date":"2025-06-17T13:03:14","date_gmt":"2025-06-17T13:03:14","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/database-syntax-errors-2\/"},"modified":"2025-06-17T13:03:14","modified_gmt":"2025-06-17T13:03:14","slug":"database-syntax-errors-2","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/database-syntax-errors-2\/","title":{"rendered":"Database Syntax Errors"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">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 &#8211; see the following:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When I go to the General clean-up panel in the plugin settings:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>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-&gt;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-&gt;__construct, ADBC_Clean_DB_List-&gt;aDBc_prepare_elements_to_clean, aDBc_count_all_elements_to_clean, aDBc_count_elements_to_clean\"<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When I do a manual cleanup with orphaned term meta enabled:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>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-&gt;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-&gt;__construct, ADBC_Clean_DB_List-&gt;aDBc_prepare_elements_to_clean, ADBC_Clean_DB_List-&gt;process_bulk_action, aDBc_clean_all_elements_type, aDBc_clean_elements_type\"<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When I do a scheduled cleanup with orphaned term meta enabled:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>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\"<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see I have a non-standard database prefix &#8211; I don&#8217;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.<\/p>\n","protected":false},"template":"","class_list":["post-18516089","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18516089","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18516089\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18516089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}