Z
Z
zabavnikov.com2019-08-02 17:16:27
MySQL
zabavnikov.com, 2019-08-02 17:16:27

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

3 answer(s)
R
retvizan, 2019-08-04
@retvizan

There are at least 6 ways, see Select multiple entries from each group

V
Vyacheslav Plisko, 2019-08-07
@AmdY

Use with with the right parameters
Not the best way, but there shouldn't be any particular problems.

Z
zabavnikovcom, 2019-08-08
@zabavnikovcom

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 question

Ask a Question

731 491 924 answers to any question