Q:

Is any parent offline in mysql adjacency list model? 

I have a database table which looks like this:
id | parent_id | status
1  | null      | 1
2  | null      | 0
3  | null      | 1
4  | 2         | 1
5  | 4         | 1

So, as you can see, we have some categories being children of each other, and the depth is unlimited. 
What I want to know, is there an easy way to find out if any parents in a particular tree has status 0? 
I know if there was a fixed depth then I could just do that many joins, and then use Min(status) to find out if any of them are set to 0, but I don't know how to do this having an undefined depth? 

A:

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.