I have a table (id, parent_id, data)
where parent_id
points to another row in same table (or is null).
Is there a standard way to query (1) all the ancestors of a certain id and (2) all the descendants of a certain id?
I'm also doing this in DBIx::Class
, so if there's a most convenient way to do it with that module (or some other), I'd love to hear about that as well.
EDIT: clarify - all parents = all ancestors, all children = all descendants.