我想运行此查询,以便使用wp_comments表中实际存在的注释更新WordPress wp_posts表中的comment_count。在以前的托管环境中似乎出现了问题:
UPDATE wp_posts SET wp_posts.comment_count = (SELECT COUNT(*) FROM wp_comments WHERE wp_comments.comment_post_ID = wp_posts.ID AND wp_comments.comment_approved = '1' );
但是我收到了这个错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
phpmyadmin显示"("在SELECT之前。本地它很好。有人知道这里有什么问题吗?