pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jason Kwok <jason@newhonest.com>
To: pgsql-sql@postgresql.org
Subject: Recursive select
Date: Fri, 26 Oct 2001 14:57:18 +0800
Message-ID: <00af01c15deb$74289940$0201a8c0@newhonest.com> (raw)

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




view thread (11+ messages)  latest in thread

Message-ID: <00af01c15deb$74289940$0201a8c0@newhonest.com>
Permalink:  ../00af01c15deb$74289940$0201a8c0@newhonest.com/
Also on:    postgresql.org/message-id/00af01c15deb$74289940$0201a8c0@newhonest.com

 · 

reply

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: jason@newhonest.com
  Subject: Re: Recursive select
  In-Reply-To: <00af01c15deb$74289940$0201a8c0@newhonest.com>

* 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