this was brought up by theBrent.
but i try to rephrase here, as i would like to know the answer as well.
i have a MySQL table containing categories having a “foreign”-key to itself.
so that evey subcategory hold the id of the parentcategory. that way it’s posible to have as many subcategories as i want.
example:
| id | parent_id | name
| 1 | NULL | world
| 2 | 1 | europe
| 3 | 1 | amerika
| 4 | 3 | usa
| 5 | 4 | tennesy
| 6 | 5 | memphis
| 7 | 2 | germany
| 8 | 7 | w?rtemberg
| 9 | 8 | stuttgart
| 10 | 8 | schwenningen a.n.
structure:
world
* amerika
- tennesy
. memphis
* europe
- germany
. w?rtemberg
stuttgart
schwenningen a.n
now i wanna have one SQL statement selecting all subcategories e.g. of germany.
may anybody help?