In the last episode (Oct 22), Daniel _a_ said:
> I have a table in database which describes tree structure of article groups.
> In this table I have:
> 1. group_id - group identifier
> 2. parent_group_id - identifier of parent group
> I need to select history, from top to wanted group.
> I can't c
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