A
A
Alexander N++2014-07-16 14:22:38
MySQL
Alexander N++, 2014-07-16 14:22:38

Mysql NestedSet - how to select user comments + subcomments?

Tell me how to select all comments of the specified user + highlights.
sqlfiddle.com/#!2/d3aada/3 overgrowing
thanks!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry Entelis, 2014-07-16
@DmitriyEntelis

habrahabr.ru/post/153861 - turnkey solution

C
Cyril, 2014-07-16
@llirikkkk

hmm, based on the condition: select all comments of the specified user , I
suggest using a simple select
this query ^^ selects ALL comments of a specific user + highlights (I suspect that these are comments of a higher / lower level, but this does not change the essence, because they are also comments)
maybe Is it worth a little more detail to describe what you need?
and maybe I'm the only one who doesn't understand what the columns mean?

`root` int(10) unsigned DEFAULT NULL,
 `lft` int(10) unsigned NOT NULL,
 `rgt` int(10) unsigned NOT NULL,

S
Sergey, 2014-07-16
@TsarS

Offtopic. And how will NestedSet react to the removal of a comment? It is necessary to set new lft and rgt when deleting?

A
Alexander N++, 2014-07-16
@sanchezzzhak

Upd.
You need to get the user's comments and the comments attached to them, if any.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question