Created
June 26, 2018 07:14
-
-
Save ssatz/8f8c4a168bd2ef928c430e2c6a66e0d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t1.name AS lev1, t2.name as lev2, t3.name as lev3, t4.name as lev4 | |
FROM `categories` AS t1 | |
LEFT JOIN categories AS t2 ON t2.parent_id = t1.id | |
LEFT JOIN categories AS t3 ON t3.parent_id = t2.id | |
LEFT JOIN categories AS t4 ON t4.parent_id = t3.id | |
WHERE t1.id = 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment