PDA

View Full Version : Selecting users who post ONLY in certain forums


Flimflamsam
10-20-2005, 01:08 AM
I'm using 3.0.7 right now, I'm trying to get a specific drilled down list of users but am having trouble getting the exact results I want.

Out of my forums, I want to select users that have posted in forums (lets say IDs 7, 21 and 26) but have not posted in any other forums.

I've got the initial list of users that have posted in the aforementioned forums, but also in others - I just want the drilled down information now, but can't figure out the SQL.

Currently, I have done the initial query which grabbed all of the userids:


select distinct(post.userid) from post inner join thread on post.threadid=thread.threadid where forumid in (7, 21, 26);

From there, I want to do something like:


select distinct(post.userid) from post inner join on post.threadid=thread.threadid where post.userid in (1,3,5,7) and forumid not in (7, 21, 26)

I realise the latter statement is somewhat self-negating, and doesn't return the results I expect either - so I need a little help with this.

Thanks!