You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dan Neumann edited this page Mar 8, 2015
·
1 revision
Change the forum_id of all topics in ORIGIN_FORUM:
-- Move topicsUPDATE topics
SET forum_id =FROM_FORUM.idWHERE forum_id =TO_FORUM.id
Re-calculate TO_FORUM's column caches:
UPDATE forums
SET
topics_count =sub.topics_count,
posts_count =sub.posts_countFROM (
SELECTf.id forum_id,
COUNT(t.id) topics_count,
SUM(t.posts_count) posts_count
FROM forums f
JOIN topics t ONf.id=t.forum_idGROUP BYf.id
) sub
WHEREforums.id=sub.forum_idANDforums.id=TO_FORUM.id