Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Returning all the Messages in a Thread

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-29 : 22:53:38
Vipul Shah writes "I just went through your article on the page
http://4guysfromrolla.com/webtech/sqlguru/q120899-1.shtml
Just go thru it.

Well had u tried that out yourselves? It doesn't work. I don't think it is possible
to return all the Messages in a thread with a single SQL statement. You are rquired to join the table in a recursive join with as many joins as the depth of the thread and if we make the depth-infinite then it isn't possible.

But I just wanted to how do I achieve the following:

I have a table with the fields

PostID
ParentPostID
LevelId
ThreadID
Subject
Message

The ThreadID is unique for each thread and the LevelID indicates
the depth in that thread.

Now i have a thread like this:

A
-B
--C
-D
--E

Now if I delete say A in the thread then this should
split into 2 different threads such as

B
-C

and

D
-E

and the LevelID and the ThreadID's will change. Now here how do I distinguish that C belongs to one thread and E belongs to another.I have to know that because I have to assign separate thread ID's to the 2 different threads?"
   

- Advertisement -