X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DC9ABD1C7F3 for ; Thu, 29 Jan 2004 10:28:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 52602-06 for ; Thu, 29 Jan 2004 06:28:17 -0400 (AST) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id 89753D1D105 for ; Thu, 29 Jan 2004 06:28:04 -0400 (AST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1) id 1Am9P7-000Pk3-0Z; Thu, 29 Jan 2004 10:28:11 +0000 Received: by mainbox.archonet.com (Postfix, from userid 529) id BDF4E17C09; Thu, 29 Jan 2004 10:27:55 +0000 (GMT) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id EDB88169B6; Thu, 29 Jan 2004 10:27:52 +0000 (GMT) From: Richard Huxton To: "Kumar" , "psql" Subject: Re: SQL Query for Top Down fetching of childs Date: Thu, 29 Jan 2004 10:27:51 +0000 User-Agent: KMail/1.5 References: <00ad01c3e62e$b70ccf60$7502a8c0@hdsc.com> In-Reply-To: <00ad01c3e62e$b70ccf60$7502a8c0@hdsc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200401291027.52174.dev@archonet.com> X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.15.3 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/249 X-Sequence-Number: 16642 On Thursday 29 January 2004 06:11, Kumar wrote: > Dear Friends, > > Postgres 7.3.4 on RH Linux 7.2. > > I need a query to get the Childs of a parent (Top down analysis). Need to > list all the departments(Childs) of a parent organization. The table > structure is Two places to look for examples: 1. the contrib/tablefunc folder has an example of this sort of thing 2. search the mailing list articles for CONNECT BY (oracle's name for this sort of thing) or "tree" -- Richard Huxton Archonet Ltd