Answer the question
In order to leave comments, you need to log in
How to display category hierarchy?
I have two tables category and subcategories, I need to get the hierarchy using Spring Boot JPA to display on the page
Hierarchy Example
Answer the question
In order to leave comments, you need to log in
Maybe it doesn't reset? But it’s just that the number 10 appears there, but at the same time the style of the block is such that the unit becomes invisible?
That is, overflow and text-align:right
You can aggregate data in DB like this:
SELECT
category.id, category.title, ARRAY_AGG(subcategory.title)
FROM category
JOIN subcategory ON subcategory.category_id = category.id
GROUP BY category.id, category.title;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question