Database error: You have an error in your SQL syntax term_taxonomy

It’s been a while since this syntax error has been happening, I tried to look it up, have read articles and forum’s posts on this issue, but I still couldn’t fix it. It says I have an error on my database, but I’m afraid it might be my server. This mysql error is happening when I edit articles. I wished I could explain this better, but I have no idea of what’s going, this is what I get when I check the error log (a part or two might be odd because I translated to English):

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 ') AND (2u98_posts.post_author <> 77777 OR ( (2u98_term_taxonomy.taxonomy = "...' at line 3 for query SELECT SQL_CALC_FOUND_ROWS 2u98_posts.ID FROM 2u98_posts LEFT JOIN 2u98_term_relationships ON (2u98_posts.ID = 2u98_term_relationships.object_id) LEFT JOIN 2u98_term_taxonomy ON ( 2u98_term_relationships.term_taxonomy_id = 2u98_term_taxonomy.term_taxonomy_id ) WHERE 1=1 AND ( 2u98_term_relationships.term_taxonomy_id IN (152) ) AND ( (2u98_term_taxonomy.taxonomy = "author" AND 2u98_term_taxonomy.term_id = '345')) AND 2u98_posts.post_type = 'post' AND (2u98_posts.post_status = 'publish' OR 2u98_posts.post_status = 'queued' OR 2u98_posts.post_status = 'processing' OR 2u98_posts.post_status = 'hold') AND (2u98_posts.post_author <> 77777 OR ( (2u98_term_taxonomy.taxonomy = "author" AND 2u98_term_taxonomy.term_id = '345')) AND EXISTS (SELECT 1 FROM 2u98_postmeta WHERE 2u98_postmeta.post_id = 2u98_posts.id AND 2u98_postmeta.meta_key = "_wp_attachment_metadata"))) AND (2u98_posts.post_author <> 77777 OR ( (2u98_term_taxonomy.taxonomy = "author" AND 2u98_term_taxonomy.term_id = '345')) AND EXISTS (SELECT 1 FROM 2u98_postmeta WHERE 2u98_postmeta.post_id = 2u98_posts.id AND 2u98_postmeta.meta_key = "_wp_attachment_metadata"))) GROUP BY 2u98_posts.ID ORDER BY 2u98_posts.post_date DESC LIMIT 0, 5 made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts