I have a categories table in my database with the following structure:
id | parent_id | name
Top level categories have a parent_id
of 0, where as all other categories can be children of other categories. There are parents of categories, grand-parents, great-grandparents, etc.
This is my current SQL statement:
SELECT * from `categories` ORDER BY `parent_id`;
I want to see something like the following in my select box:
MOVIES
MOVIES -> ACTION
MOVIES -> ACTION -> ENGLISH
Is there an SQL statement that can handle this recursion in the categories?