Sql query to get username and email from members

Nuno

Well-known member
Hello

I'm looking for help to get a SQL query to list the username and email of members who have posted threads and posts in two specific nodes.

Any help on this?

Thanks
 
Hello

I'm looking for help to get a SQL query to list the username and email of members who have posted threads and posts in two specific nodes.

Any help on this?

Thanks

Run this query in the SQL Box at phpmyadmin. (Choose the db where your forum resides on).

Code:
SELECT u.username, u.email, COUNT( * ) AS posts
FROM xf_post AS p
LEFT JOIN xf_thread AS t ON ( t.thread_id = p.thread_id ) 
LEFT JOIN xf_user AS u ON ( u.user_id = p.user_id ) 
WHERE t.node_id IN(x,y)
GROUP BY p.user_id
ORDER BY posts DESC 
;

Replace x and y with the actual node id's that you want to pull the info. Also if you are using another prefix, other than the standard xf_, for your forum tables, then use that instead appended to the table names.
 
Top Bottom