mysql query - blog posts and comments with limit
Posted
by Lemon
on Stack Overflow
See other posts from Stack Overflow
or by Lemon
Published on 2010-06-02T01:05:20Z
Indexed on
2010/06/02
1:14 UTC
Read the original article
Hit count: 386
Hi,
I have 2 tables: comments and posts and I'd like to display a list of 15 posts and maximum 2 most recent comments under each blog post
the database scheme looks like this
posts_table: post_id, post_txt, post_timestamp comments_table: post_id, comment_txt, comment_timestamp
how the mysql query should look like to select 15 posts and related comments (max 2 most recent ones per post) ???
thanks, Leo
© Stack Overflow or respective owner