💻 하나씩 차곡차곡/프로그래머스 (SQL)

[SELECT/LEVEL2] 업그레이드 된 아이템 구하기 (MySQL)

뚜루리 2024. 10. 23. 00:00
728x90
320x100

MySQL

SELECT ITEM_ID, ITEM_NAME, RARITY
FROM ITEM_INFO 
WHERE ITEM_ID IN (SELECT B.ITEM_ID
                    FROM ITEM_INFO A, ITEM_TREE B
                    WHERE A.ITEM_ID = B.PARENT_ITEM_ID
                    AND A.RARITY = 'RARE' )
ORDER BY ITEM_ID DESC
728x90
320x100