Answer the question
In order to leave comments, you need to log in
How to select 5 children for each comment?
Tell me how to select several child comments for each comment, sorted by creation date.
Answer the question
In order to leave comments, you need to log in
There are at least 6 ways, see Select multiple entries from each group
Use with with the right parameters
Not the best way, but there shouldn't be any particular problems.
I settled on this solution - in the comments table I added the reply_ids field, which stores the list of id of the last child comments. The first request is for all parents. I collect reply_ids from all parents into one array. By the second request, I get a list of child comments by reply_ids. Well, then I add the replies attribute to each parent comment with its child comments, if any.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question