@hims056 - I'd imagine parent_id would be null if it didn't have a parent... so it'd be the chicken that laid the first egg
–
MikeOct 6 '12 at 4:22

what do you mean that a parent has status 0? Plz give an example
–
AnkurOct 6 '12 at 4:24

@Mike is correct, if a category does not have a parent (hence it is a root category) then it has a parent_id of null Think of the categories like a muli-level site navigation.
–
HailwoodOct 6 '12 at 4:25

@Ankur So, for example, if I was using the category 5 as a base, I would want to know if either category 4, or category 2 has status 0
–
HailwoodOct 6 '12 at 4:32

1 Answer
1

With the adjacency list model that you are using it isn't possible because you would need to walk the graph upwards recursively, which is something that MySQL can't do. You should consider switching your data to the nested sets model where you can easily get the path to the root.