Right now I have a query that looks something like so:
SELECT id
FROM post_table post
WHERE post.post_user_id = user_id
ORDER BY (SELECT max(comment_created_date)
FROM comments_table WHERE comments_post_id = post.id) DESC,
post.post_created_date DESC
My idea for this query was that it would order a series of posts like so
Post 1:
created Date: Jan 1 2015
comments : []
Post 2:
created Date: Jan 5 2015
comments : []
Post 3:
created Date : December 1 2014
comments: [
0: Created Date: Jan 6 2015
]
So in this case the order the posts would be returned in is
Post 3, Post 2, Post 1
Because Post 3 has a comment that is newer than any other posts, and Post 2 was created before Post 1.
But when I run the query, the posts are still all sorted by their created date and the query doesn't seem to take into account the comments created date.