Received: from imr2.ericy.com (imr2.ericy.com [12.34.240.68]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4ODirA47754 for ; Thu, 24 May 2001 09:44:53 -0400 (EDT) (envelope-from danw@netmanager7.rtp.ericsson.se) Received: from mr7.exu.ericsson.se (mr7att.ericy.com [138.85.92.15]) by imr2.ericy.com (8.11.3/8.11.3) with ESMTP id f4ODim827652 for ; Thu, 24 May 2001 08:44:48 -0500 (CDT) Received: from eamrcnt749 (eamrcnt749.exu.ericsson.se [138.85.133.47]) by mr7.exu.ericsson.se (8.11.3/8.11.3) with SMTP id f4ODimH00679 for ; Thu, 24 May 2001 08:44:48 -0500 (CDT) Received: FROM netmanager7.rtp.ericsson.se BY eamrcnt749 ; Thu May 24 08:44:47 2001 -0500 Received: from satdsp14.ericsson.COM (satdsp14.rtp.ericsson.se [147.117.84.7]) by netmanager7.rtp.ericsson.se (8.8.8+Sun/8.6.4) with ESMTP id JAA21257; Thu, 24 May 2001 09:44:58 -0400 (EDT) Received: (from danw@localhost) by satdsp14.ericsson.COM (8.9.1b+Sun/8.9.1) id JAA02032; Thu, 24 May 2001 09:44:44 -0400 (EDT) From: Daniel Wickstrom MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15117.4171.867564.863408@gargle.gargle.HOWL> Date: Thu, 24 May 2001 09:44:43 -0400 (EDT) To: "Martin Smetak" Cc: Subject: Recursive select In-Reply-To: <009301c0e368$589c0de0$0b01010a@no9.cz> References: <009301c0e368$589c0de0$0b01010a@no9.cz> X-Mailer: VM 6.72 under 21.1 (patch 10) "Capitol Reef" XEmacs Lucid X-Archive-Number: 200105/262 X-Sequence-Number: 3090 >>>>> "Martin" == Martin Smetak 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