tenants
Well-known member
@BillyGoat4130
There is probably a more elegant way of updating first_post_id
If this is a test environment, you can try running something like this:
This will only update the threads where first_post_id = 0 (which is wrong anyway, first_post_id should never be 0)
Not sure if the above works, so try it on a test enviroment
There is probably a more elegant way of updating first_post_id
If this is a test environment, you can try running something like this:
Code:
UPDATE xf_thread as thread,
(
SELECT p.post_id, t.thread_id from xf_post as p, xf_thread as t
WHERE p.thread_id = t.thread_id
AND t.first_post_id = 0
GROUP BY(p.thread_id)
ORDER BY p.post_date ASC
) AS jointids
SET thread.first_post_id = jointids.post_id
WHERE thread.first_post_id = 0
AND thread.thread_id = jointids.thread_id
This will only update the threads where first_post_id = 0 (which is wrong anyway, first_post_id should never be 0)
Not sure if the above works, so try it on a test enviroment