Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 745B39FBB2B for ; Mon, 14 May 2007 15:02:27 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 21236-04 for ; Mon, 14 May 2007 15:02:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 84B0D9FB9C0 for ; Mon, 14 May 2007 15:02:23 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by svr4.postgresql.org (Postfix) with ESMTP id 91FEA5AFCAA for ; Mon, 14 May 2007 18:02:22 +0000 (GMT) Received: obelix 172.31.0.1 from 172.31.1.1 172.31.1.1 via HTTP with MS-WebStorage 6.0.6249 Received: from panoramix by obelix; 14 May 2007 20:02:11 +0200 Subject: How to retrieve a n-ary tree in SQL? From: Joost Kraaijeveld To: pgsql-sql@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Mon, 14 May 2007 20:02:11 +0200 Message-Id: <1179165731.4936.4.camel@panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.176 tagged_above=0 required=5 tests=AWL=0.039, BAYES_50=0.001, FORGED_RCVD_HELO=0.135, UNPARSEABLE_RELAY=0.001 X-Spam-Level: X-Archive-Number: 200705/107 X-Sequence-Number: 28387 Hi, Is there a way to get a query (of function) to retrieve a n-ary tree: 1 parent node has n children and the tree is n levels deep? TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web: www.askesis.nl