sql query assistance

FedLounge

Member
Hello all. Do you know of any way to do an SQL query that will generate a list of user emails who have replied to a specific thread?

Thanks!
 
Basically something like this should work:

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);

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');
 
SQL:
select distinct email from xf_user inner join xf_post on xf_post.user_id = xf_user.user_id where thread_id = 201229;
 
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?
 
Back
Top Bottom