• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Looking for query to find where two members posted in same thread

AndyB

Well-known member
#1
I'm looking for query to find where two members posted in same thread. So far I have created this query but it does not retrieve any results.

Code:
SELECT xf_thread.thread_id
FROM xf_thread
INNER JOIN xf_post ON xf_post.thread_id = xf_thread.thread_id
WHERE xf_post.user_id='1'
AND xf_post.user_id='2'
 

AndyB

Well-known member
#3
I posted the question at Stack Overflow and here's the MySQL query that works perfectly.

Code:
SELECT thread_id
FROM xf_post
group by thread_id
having max(user_id='1') > 0
and max(user_id='2') > 0