Order results by another table?

Posted by user3462020 on Stack Overflow See other posts from Stack Overflow or by user3462020
Published on 2014-06-02T21:11:44Z Indexed on 2014/06/02 21:26 UTC
Read the original article Hit count: 91

Filed under:

I'm working on a custom forum system and I'm trying to figure out how to put a thread on the top of the list if a user posts in it.

I've got this for my query

SELECT 
user_threads.threadID, 
user_threads.title, 
user_threads.uid, 
user_threads.postDate,
thread_messages.posted
FROM 
    user_threads,
    thread_messages
WHERE
    parent = :parent
GROUP BY
    user_threads.title
ORDER BY 
    thread_messages.posted
DESC

Which doesn't appear to be working. if I post in a new thread, it remains where it is on the list.

© Stack Overflow or respective owner

Related posts about mysql