Howto retrieve all the grandchildren of all the children

From: Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl>
To: PostgreSQL-General <pgsql-general(at)postgresql(dot)org>
Subject: Howto retrieve all the grandchildren of all the children
Date: 2002-01-25 23:13:39
Message-ID: B9095DA2D217D511929B00A0C94989FE0BD634@obelix.askesis.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have three tables. Table 1 contains the root of a tree. Table 2 contains
the children of table 1 (column acting as foreign key). Table 3 contains the
children of table 2 (column acting as foreign key). Basically it contains a
three level n-ary tree.

Is it possible to retrieve the grandchildren if I have the primary key of a
record in table 1, assuming that each table has a primary key and an
appropriate foreign key, and if so, what should be the SQL syntax to do so?

TIA

Joost Kraaijeveld

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeffrey W. Baker 2002-01-25 23:48:20 Re: Howto retrieve all the grandchildren of all the
Previous Message Chris Boz Jennings 2002-01-25 21:06:52 Orionserver, CMP and PostgreSQL