SELECT email FROM xf_user
WHERE EXISTS
(SELECT post_id FROM xf_post WHERE thread_id = 1 AND xf_user.user_id = xf_post.user_id);
Taking only visible posts into account:
SQL:
SELECT email FROM xf_user
WHERE EXISTS
(SELECT post_id FROM xf_post WHERE thread_id = 1 AND xf_user.user_id = xf_post.user_id AND xf_post.message_state = 'visible');
Forgot to say thanks! This helped a lot.
I have another query-- how to find out the usernames of all users who have watched a specific thread. Any ideas?