Answer the question
In order to leave comments, you need to log in
How to build a query for pulling a tree structure like Feedback->Feedback-Response->Feedback-Response-to-Answer...->?
Hello! Faced the problem of building an sql-query to pull data from the database in the form of a tree structure.
It is possible to pull out the data, but I get a lot of requests.
Well, for example: there are articles on the site, and they have reviews (parent), while each review can have more reviews-answers (child), and these reviews have more, etc. Each review can also have several attached pictures (separate table).
All reviews are stored in one table: there are reviews without parents, and there are reviews with parents.
If you add childs to the $with array in the Answer model, then it turns out: there are so many requests:
And this is only for one answer with three levels of structure and without attached pictures I
use the Laravel framework to output the json array -laravel-fractal
I want to see examples, advice on how this is done at all..
Answer the question
In order to leave comments, you need to log in
it is necessary to select everything from the base, and then scatter the recursive function over the levels.
or google something like this
https://stackoverflow.com/questions/20215744/how-t...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question