Alias Join Table - Mailing list pgsql-sql

From Keith Gray
Subject Alias Join Table
Date
Msg-id 3BBCF50C.D3BFAF4F@heart.com.au
Whole thread Raw
Responses Re: Alias Join Table  ("Josh Berkus" <josh@agliodbs.com>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: "Ross J. Reedstrom"
Date:
Subject: Re: Need Help!!
Next
From: Keith Gray
Date:
Subject: Re: Beginner's List