I have a nested categories. this is structure.
CREATE TABLE 'category' (
'id' INT,
'title' VARCHAR(50),
'category_id' INT,
)
relation is simple
(id, parent id)
main (1, NULL)
--parent (2, 1)
----child1 (3, 2)
----child2 (4, 2)
--foo (5, 1)
----baz (6, 5)
--bar (7, 1)
I want to select category's childrens (MYSQL)
for "parent" category it is "child1" and "child2"
for "main" category it is:
--parent (2, 1)
----child1 (3, 2)
----child2 (4, 2)
--foo (5, 1)
----baz (6, 5)
--bar (7, 1)
thanks!