query to select a linked list

From: Louis-David Mitterrand <vindex+lists-pgsql-sql(at)apartia(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: query to select a linked list
Date: 2007-05-09 12:55:20
Message-ID: 20070509125520.GA17497@apartia.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

To build a threaded forum application I came up the following schema:

forum
------
id_forum | integer| not null default nextval('forum_id_forum_seq'::regclass)
id_parent| integer|
subject | text | not null
message | text |

Each message a unique id_forum and an id_parent pointing to the replied
post (empty if first post).

How can I build an elegant query to select all messages in a thread?

Thanks,

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Gregory Stark 2007-05-09 13:24:22 Re: query to select a linked list
Previous Message Rommel the iCeMAn 2007-05-08 14:10:14 Re: Error: Input string was not in a correct format