pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedAlias Join Table
2+ messages / 2 participants
[nested] [flat]
* Alias Join Table
@ 2001-10-04 23:47 Keith Gray <keith@heart.com.au>
0 siblings, 1 reply; 2+ messages in thread
From: Keith Gray @ 2001-10-04 23:47 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Alias Join Table
@ 2001-10-05 01:01 Josh Berkus <josh@agliodbs.com>
parent: Keith Gray <keith@heart.com.au>
0 siblings, 0 replies; 2+ messages in thread
From: Josh Berkus @ 2001-10-05 01:01 UTC (permalink / raw)
To: Keith Gray <keith@heart.com.au>; pgsql-sql
Keith,
There are a number of posts and papers on tree structures , both in the
SQL list archives, and on Roberto Mello's resources at
techdocs.postgresql.org.
-Josh
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-10-05 01:01 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-10-04 23:47 Alias Join Table Keith Gray <keith@heart.com.au>
2001-10-05 01:01 ` Josh Berkus <josh@agliodbs.com>
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