https://school.programmers.co.kr/learn/courses/30/lessons/273711
SELECT ITEM.ITEM_ID, ITEM.ITEM_NAME, ITEM.RARITY
FROM
(SELECT II.ITEM_ID, II.ITEM_NAME, II.RARITY, IT.PARENT_ITEM_ID
FROM ITEM_INFO II JOIN ITEM_TREE IT ON II.ITEM_ID = IT.ITEM_ID
) AS ITEM
JOIN
(SELECT * FROM ITEM_INFO II WHERE II.RARITY = 'RARE') AS II
ON ITEM.PARENT_ITEM_ID = II.ITEM_ID
ORDER BY ITEM.ITEM_ID DESC