My problem is the following:
My tables are MESSAGE
and MESSAGE_COMMENT
,
MESSAGE (id,content)
MESSAGE_COMMENT (id, message_id, content)
I need to select all messages and max 3 comments for each message, like in this example:
type | id | content
M 15 "this is a message with no comments"
M 16 "this is another message with many comments"
R 16 "comment1"
R 16 "comment2"
R 16 "comment3"
M 17 "this is another message with no comments"
"id" is MESSAGE.id
when it's a message and COMMENT.message_id
when it's a comment.
I hope I have clearly explained my problem..