Try the following. (Best to try on a backup first to make sure it works well)
Update firstpostid in thread:
PHP Code:
UPDATE thread SET firstpostid = (SELECT postid FROM post WHERE threadid = thread.threadid ORDER BY postid ASC LIMIT 0,1)
Update lastpostid in thread:
PHP Code:
UPDATE thread SET firstpostid = (SELECT postid FROM post WHERE threadid = thread.threadid ORDER BY postid DESCLIMIT 0,1)
Update date in thread:
PHP Code:
UPDATE thread SET lastpost = (SELECT dateline FROM post WHERE threadid = thread.threadid ORDER BY postid DESC LIMIT 0,1)
Update lastpost in forum:
PHP Code:
UPDATE forum SET lastpost = (SELECT b.dateline FROM thread AS a INNER JOIN post AS b ON a.threadid = b.threadid WHERE a.forumid = forum.forumid ORDER BY b.postid DESC LIMIT 0,1)
Update lastpostid in forum:
PHP Code:
UPDATE forum SET lastpostid = (SELECT b.postid FROM thread AS a INNER JOIN post AS b ON a.threadid = b.threadid WHERE a.forumid = forum.forumid ORDER BY b.postid DESC LIMIT 0,1)
Update lastposter in forum:
PHP Code:
UPDATE forum SET lastposter = (SELECT b.username FROM thread AS a INNER JOIN post AS b ON a.threadid = b.threadid WHERE a.forumid = forum.forumid ORDER BY b.postid DESC LIMIT 0,1)
Update lastposterid in forum:
PHP Code:
UPDATE forum SET lastposterid = (SELECT b.userid FROM thread AS a INNER JOIN post AS b ON a.threadid = b.threadid WHERE a.forumid = forum.forumid ORDER BY b.postid DESC LIMIT 0,1)