Recursive select

From: Daniel Wickstrom <danw(at)rtp(dot)ericsson(dot)se>
To: "Martin Smetak" <minca_sql(at)no9(dot)cz>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Recursive select
Date: 2001-05-24 13:44:43
Message-ID: 15117.4171.867564.863408@gargle.gargle.HOWL
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>>>>> "Martin" == Martin Smetak <minca_sql(at)no9(dot)cz> writes:

Martin> Hi all! Anyone know if it's possible to make a recursive
Martin> select from a table ? My problem: I got a table of "some
Martin> categories" which all points to its parrent
Martin> one(tree)...shown below. And I want to select all names of
Martin> parrent categories of one child, lets say "fast[4]". Now
Martin> I'm solving that with many SQL queries like : "SELECT
Martin> main_id FROM cat WHERE id=4;"....but I would like to
Martin> optimize this.

Martin> Anyone can help or point me to a way ??

The Openacs project has implemented a couple of different methods for
handling tree queries. Check out these two threads:

http://openacs.org/bboard/q-and-a-fetch-msg.tcl?msg_id=0000eC&topic_id=11&topic=OpenACS

http://openacs.org/bboard/q-and-a-fetch-msg.tcl?msg_id=0000j6&topic_id=12&topic=OpenACS%204%2e0%20Design

Regards,

Dan Wickstrom

Browse pgsql-sql by date

  From Date Subject
Next Message Mark 2001-05-24 18:45:53 photos and OID's
Previous Message Tod McQuillin 2001-05-24 13:39:50 Re: Stored Procedures?