View Single Post

   
  #1 (permalink)  
Old 04-19-2008, 04:24 PM
Louis-David Mitterrand
 
Posts: n/a
Default query to select a linked list

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,

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Reply With Quote