Tuesday, 10 September 2013

How to select the title with the latest datetime?

How to select the title with the latest datetime?

I have these two tables in mysql:
posts (id)
post_titles (id, post_id, title, datetime, user_id)
post_contents (id, post_id, content, datetime, user_id)
posts (id) == posts_titles (post_id)
In the post_titles and post_contents can be multiple entries for 1 posts
(id).
What i need, is to select the title which has the latest datetime. I would
have to select it all by using the posts (id). How could i do that?
EDIT: i need to select the title and the content together.

No comments:

Post a Comment