因为两个论坛合并,主题数和帖子数对应不上,所以自己写了下批量执行的语句,希望大家用得上。
- UPDATE pre_common_member_count m_c
- LEFT JOIN pre_forum_thread f_t ON f_t.authorid=m_c.uid
- SET m_c.threads=(SELECT COUNT(tid) FROM pre_forum_thread WHERE authorid=m_c.uid)
- WHERE m_c.uid=f_t.authorid;
复制代码 #批量修改主题数
- UPDATE pre_common_member_count SET posts=threads;
复制代码 #批量将帖子数等于主题数
- UPDATE pre_common_member_count m_c
- LEFT JOIN pre_forum_post f_p ON f_p.authorid=m_c.uid
- SET m_c.posts=((m_c.posts)+(SELECT COUNT(tid) FROM pre_forum_post WHERE authorid=m_c.uid)) WHERE m_c.uid=f_p.authorid;
复制代码 #追加回复数
- UPDATE pre_common_member_count m_c
- LEFT JOIN pre_forum_post_1 f_p ON f_p.authorid=m_c.uid
- SET m_c.posts=((m_c.posts)+(SELECT COUNT(tid) FROM pre_forum_post_1 WHERE authorid=m_c.uid))
- WHERE m_c.uid=f_p.authorid;
复制代码 #追加分表回复数,无分别则不需要执行该语句
请按顺序一句句执行,如果一次性执行,可能服务器会卡死。 |
|