Hi,
I'm inexperienced with SQL and I'm not sure how to form this query correctly.
Select comment.text, (COUNT(parent.id)-1) AS depth
FROM comments AS comment,
comments AS parent
WHERE comment.lft BETWEEN parent.lft AND
parent.rght LEFT JOIN users as user ON (comment.user_id = user.id)
GROUP BY comment.id ORDER BY comment.lft
I'm trying to retrieve nested user comments stored in a MySQL database. Along with each comment I'm also trying to retrieve the comment's associated user with a JOIN but I'm not sure what the syntax would be for something like this.