this is my mysql table
i want to get the result
i try it the this code include join when i make second picture
SELECT t1.name AS lev1, t2.name as lev2, t3.name as lev3, t4.name as lev4
FROM category AS t1
LEFT JOIN category AS t2 ON t2.parent = t1.category_id
LEFT JOIN category AS t3 ON t3.parent = t2.category_id
LEFT JOIN category AS t4 ON t4.parent = t3.category_id
WHERE t1.name = 'ROOT'
i try to using this code in java spring boot but i can't using it because of join so i want to know that how can i change the sql code without join to get the same result for using java spring boot
thanks