I have the following table structure and content:
+-------------+-----------+------------+
| category_id | parent_id | name |
+-------------+-----------+------------+
| 1 | 0 | Test 1 |
| 2 | 1 | Test 1.1 |
| 3 | 2 | Test 1.1.1 |
| 4 | 0 | Test 2 |
| 5 | 0 | Test 3 |
| 6 | 5 | Test 3.1 |
| 7 | 6 | Test 3.1.1 |
+-------------+-----------+------------+
Would it be possible to write a recursive query to return the result as following:
+-------------+--------------------------------+
| category_id | path |
+-------------+--------------------------------+
| 1 | Test 1 |
| 2 | Test 1 > Test 1.1 |
| 3 | Test 1 > Test 1.1 > Test 1.1.1 |
| 4 | Test 2 |
| 5 | Test 3 |
| 6 | Test 3 > Test 3.1 |
| 7 | Test 3 > Test 3.1 > Test 3.1.1 |
+-------------+--------------------------------+
Thank you!