I understand that you only have one table. The query I gave you joins the same table
against itself, and aliases it to a, b, and c. The only question was whether the depth
is always the same.
Steve Meyers
> Hi
>
> I have one table and the depth is not always the same.
>
> Anyway thanks :)
>
> > If the depth of the tree is always the same, it is actually
> > fairly easy. For instance, if there are three levels:
> >
> > SELECT c.group_id FROM table a, table b, table c WHERE a.group_id
> > = 12345 AND b.group_id = a.parent_group_id AND c.group_id =
> > b.parent_group_id
> >
> > If you don't know the depth, you'll have to do a recursive search
> > (keep on querying for the next parent until you run out of parents).
> >
> > Steve Meyers