Received: from mail.newhonest.com (vp239045.uac62.hknet.com [202.71.239.45]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f9Q6v8P13642 for ; Fri, 26 Oct 2001 02:57:14 -0400 (EDT) (envelope-from jason@newhonest.com) Received: from jason (jason.newhonest.com [192.168.1.2]) by mail.newhonest.com (8.11.2/8.11.2) with SMTP id f9Q70o430264 for ; Fri, 26 Oct 2001 15:00:51 +0800 Message-ID: <00af01c15deb$74289940$0201a8c0@newhonest.com> From: "Jason Kwok" To: Subject: Recursive select Date: Fri, 26 Oct 2001 14:57:18 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="big5" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Archive-Number: 200110/386 X-Sequence-Number: 5338 I have a table : MyID parentID ================ 5 6 6 7 3 13 7 3 Is there any simple select statement that can get all rows with MyID = 5 and all its parents? That means 5's parenet is 6, 6's parent is 7, 7's parent is 3..... Jason --- Virus Free Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.286 / Virus Database: 152 - Release Date: 2001/10/9