Home » RDBMS Server » Server Administration » A select statement; need some help
A select statement; need some help [message #372822] Mon, 12 March 2001 05:11
stott
Messages: 1
Registered: March 2001
Junior Member
Hi,
would really appreciate some help with a select statement:

Have this table; forum_info:
INFO_ID NUMBER NOT NULL, (PK)
PARENT_ID NUMBER,
TITLE VARCHAR2 (50) NOT NULL,
CREATED DATE

The table contains, for instance, the following:
info_id, parent_id, created, title
1, ,2001-03-03, L1
2, ,2001-03-04, L1
3, 1 ,2001-03-02, L2
4, 2 ,2001-03-05, L2
5, 4 ,2001-03-06, L3

The column parent_id is refering to a parent in the table.
The table shall be used in a forum, and now I would like your help with creating a select statement that returns all the rows in the table in a way so that the newest thread comes first, followed by its replies, and their replies followed by their replies and so forth - and then the next thread followed by its replies and so on. Like this:

thread 100
reply to thread 100
reply to thread 100
thread 99
thread 98
reply to thread 98
reply to reply to thread 98
thread 97
.......

Would be really greatful for some help.
/Stefan
Previous Topic: Calling Functions within a CREATE Statement
Next Topic: FASTER QUERY
Goto Forum:
  


Current Time: Sat Jun 01 16:46:20 CDT 2024