XF 2.0 Can this be done for specific user only?

KSA

Well-known member
Can this query be executed for specific user only without including all users

UPDATE xf_user AS user
SET message_count = (
SELECT COUNT(*)
FROM xf_post AS post
LEFT JOIN xf_thread AS thread ON (thread.thread_id = post.thread_id)
WHERE post.user_id = user.user_id
AND post.message_state = 'visible' AND thread.discussion_state = 'visible'
GROUP BY post.user_id
);
 
Last edited:
SQL:
UPDATE xf_user AS user
SET message_count = (
    SELECT COUNT(*)
    FROM xf_post AS post
    LEFT JOIN xf_thread AS thread ON (thread.thread_id = post.thread_id)
    WHERE post.user_id = user.user_id
    AND post.message_state = 'visible' AND thread.discussion_state = 'visible'
    GROUP BY post.user_id
)
WHERE user.user_id = X;
replace X with the user id
 
  • Like
Reactions: KSA
Top Bottom