A
A
Abc Edc2016-02-24 16:37:03
PHP
Abc Edc, 2016-02-24 16:37:03

How to sort in Closure Table?

There are tables
comments-id,name...
comments_tree- ancestor_id, descendant_id,parent_id,
level
that is, if, for example, a comment was added to the tree a year later and has an id of 666 and the first parent id is 1.
And between them there are a cloud of other trees with comments, then the whole tree was still taken until the whole tree was passed

SELECT
 *
FROM comments c
  JOIN comments_tree ct ON c.id = ct.descendant_id
ORDER BY ct.level ASC
Limit..
OFFSET..

Here, for example, a tree begins, but it can be interrupted by others without letting the first one reach the end

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question