Answer the question
In order to leave comments, you need to log in
What should be added to the request to get the number of defined values?
Here is such a request
SELECT "bonus", (nlevel(tree_path) - nlevel('2.383')) as nl,count(nl)
FROM "user"
INNER JOIN "user_bonus_item"
ON user_id_from = "user".id
WHERE ("tree_path" ~ '2.383.*{0,5}')
AND user_id_to = user_id_from
AND ("user_bonus_item"."mounth_bonus" = '9:2017')
AND ("bonus" > 50)
ORDER BY "nl";
bonus | nl
--------+----
305.00 | 0
52.00 | 1
52.00 | 1
51.00 | 1
52.00 | 2
60.00| 3
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question