Received: from relay.it.pl (relay.it.pl [195.116.142.10]) by hub.org (8.9.2/8.9.1) with ESMTP id JAA16029 for ; Wed, 3 Mar 1999 09:57:17 -0500 (EST) (envelope-from barteo@it.pl) Received: from zloty.it.com.pl (zloty.it.com.pl [195.116.142.4]) by relay.it.pl with ESMTP id PAA03211 for ; Wed, 3 Mar 1999 15:55:37 +0100 (MET) Received: from it.pl (yen.it.pl [195.116.139.234]) by zloty.it.com.pl with ESMTP id PAA21192 for ; Wed, 3 Mar 1999 15:55:36 +0100 (MET) Sender: root@zloty.it.com.pl Message-ID: <36DD4E78.9BC36320@it.pl> Date: Wed, 03 Mar 1999 16:00:08 +0100 From: Bartek Teodorczyk X-Mailer: Mozilla 4.07 [en] (X11; I; Linux 2.1.130 i586) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Trees in SQL (again) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I'm trying to implement set model of trees in SQL and I found a problem: How to find first level children of parent? For this structure (with left and right set values): 1 Jerry 10 | ------------------- | | 2 Bert 3 4 Chuck 9 | ------------ | | 5 Donna 6 7 Fred 8 The question is: Who is first level child of Jerry? The answer should produce: Bert Chuck BarTeo