Gossamer Forum
Home : General : Databases and SQL :

Re: [dan2003] here goes sql statement

Quote Reply
Re: [dan2003] here goes sql statement In reply to
One quick solution to your problem is using a "recursive" structure in your POSTS table.

POSTS:
PID
ParentPID
UserID

Basically, when someone new replies to a post, the original first PID should be inserted into the ParentPID column.

Example of how this would look:

PID = 1000
ParentPID = NULL (or 0)
UserID = 100

PID=1001
ParentPID = 1000
UserID = 99

Then all you have to do to show the original answer (first), is to use PARENTPID IS NULL.

And then order the PARENTPID thereafter...
========================================
Buh Bye!

Cheers,
Me

Last edited by:

Stealth: Feb 10, 2003, 9:17 AM
Subject Author Views Date
Thread here goes sql statement dan2003 4354 Feb 8, 2003, 10:41 PM
Thread Re: [dan2003] here goes sql statement
dan2003 4123 Feb 9, 2003, 11:48 AM
Post Re: [dan2003] here goes sql statement
Stealth 4059 Feb 10, 2003, 8:44 AM