recursive query? - Mailing list pgsql-general

From CSN
Subject recursive query?
Date
Msg-id 20040202215436.2850.qmail@web40609.mail.yahoo.com
Whole thread Raw
Responses Re: recursive query?  (Andrew Rawnsley <ronz@ravensfield.com>)
List pgsql-general
I have a table with these columns:

id, node, parent_node_id

The top-most nodes would have a parent_node_id of
NULL. Is it possible to get a node, and all its parent
nodes, in a single query?

For example, a node might be:

books > computers > databases > oss > postgres

and the rows fetched would be:

1,books,NULL
2,computers,1
3,databases,2
4,oss,3
5,postgres,4

TIA,
CSN



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Postgresql 7.3 And Redhat Enterprise 3
Next
From: Doug McNaught
Date:
Subject: Re: Are there commands to enquire about table structure?