Archange Posted May 5, 2017 Share Posted May 5, 2017 Здравствуйте, возникла проблема, кол-во тем подсчитываются неверно, что делать уже не знаю, кеш чистил, возникла проблема эта после переноса всех данных на новый хост. Quote Link to comment Share on other sites More sharing options...
WOLF Posted May 5, 2017 Share Posted May 5, 2017 Не вижу у вас на форуме этих разделов пробуйте: Пересчет сообщений пользователей: UPDATE core_members m LEFT JOIN ( SELECT author_id, COUNT(*) as posts FROM forums_posts WHERE queued=0 GROUP BY author_id ) z ON m.member_id=z.author_id SET m.member_posts=IFNULL(z.posts, 0); Пересчет сообщений в темах: UPDATE forums_topics t LEFT JOIN( SELECT topic_id, COUNT(*) as posts FROM forums_posts WHERE queued=0 GROUP BY topic_id ) z ON z.topic_id=t.tid SET t.posts=IFNULL(z.posts, 0); Пересчет тем и сообщений в форумах: UPDATE forums_forums f LEFT JOIN ( SELECT forum_id, COUNT(*) as topics, SUM(posts) as posts FROM forums_topics GROUP BY forum_id ) z ON z.forum_id=f.id SET f.topics=IFNULL(z.topics, 0), f.posts=IFNULL(z.posts, 0); Archange 1 Quote Link to comment Share on other sites More sharing options...
Archange Posted May 5, 2017 Author Share Posted May 5, 2017 Это помогло, большое спасибо! Quote Link to comment Share on other sites More sharing options...
tunofak Posted November 17, 2018 Share Posted November 17, 2018 В 05.05.2017 в 09:32, WOLF сказал: Не вижу у вас на форуме этих разделов пробуйте: Пересчет сообщений пользователей: UPDATE core_members m LEFT JOIN ( SELECT author_id, COUNT(*) as posts FROM forums_posts WHERE queued=0 GROUP BY author_id ) z ON m.member_id=z.author_id SET m.member_posts=IFNULL(z.posts, 0); Пересчет сообщений в темах: UPDATE forums_topics t LEFT JOIN( SELECT topic_id, COUNT(*) as posts FROM forums_posts WHERE queued=0 GROUP BY topic_id ) z ON z.topic_id=t.tid SET t.posts=IFNULL(z.posts, 0); Пересчет тем и сообщений в форумах: UPDATE forums_forums f LEFT JOIN ( SELECT forum_id, COUNT(*) as topics, SUM(posts) as posts FROM forums_topics GROUP BY forum_id ) z ON z.forum_id=f.id SET f.topics=IFNULL(z.topics, 0), f.posts=IFNULL(z.posts, 0); Ошибка выходит - #1104 - The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay Это для какой версии MySQL? MySQL Версия сервера: 5.5.59-0+deb8u1 - (Debian) и iPB 4.3.6 Может нужно перейти на MySQL 7.0 ++ ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.