From: Keith Gray <keith@heart.com.au>
To: SQL <pgsql-sql@postgresql.org>
Subject: Alias Join Table
Date: Fri, 05 Oct 2001 09:47:24 +1000
Message-ID: <3BBCF50C.D3BFAF4F@heart.com.au> (raw)
If I have the following 'Hierachy' table...
Child | Parent
--------------
1 | 0
2 | 1
3 | 1
4 | 3
5 | 4
6 | 3
7 | 4
How do I return a list 5,4,3,1 ?
SELECT a.Child FROM Hierachy AS a, Hierachy AS b
WHERE a.Parent = b.Child
AND a.Child = 5;
... is obviously a bit simplistic in my approach.
--
Keith Gray
Technical Development Manager
Heart Consulting Services P/L
mailto:keith@heart.com.au
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: keith@heart.com.au
Subject: Re: Alias Join Table
In-Reply-To: <3BBCF50C.D3BFAF4F@heart.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox