I have this structure:
posts:
id, content, created_at
comments:
id, post_id, content, created_at
now I would like to select 10 posts ordered by created_at desc, limit to only 10 posts. AND now the problem, I would like to get each post last 5 comments.
I have no problem doing this seperatly, but it will produce me 11 queries.... one fore getting the posts, and another 10 queries for each posts and selecting it's comments.
any ideas on how to reduce this queries?