I'm making modifications to the bboard system. I want to present a
list of message threads with the most recent reply on top. So here is
the situation: In a message thread, there is a new msg_id for each
new message. If it is part of a thread, each root_msg_id is the same
as the first message (the question).
msg_id root_msg_id subject date
-----------------------------------------------
000001 000001 The question Oct 1
000004 000001 First Reply Oct 5
000029 000001 A later Reply Nov 15
-----------------------------------------------
I want to keep this thread together yet sort my list
so that this message would be be on top because the
most recent reply was today. I can do an
order by posting_date desc, root_msg_id
But this doesn't work because the thread isn't together.
I need only one message from a thread to post to my list.
Another approach would be to select the messages by posting
date and somehow ignore or "de-select" earlier messages in
the thread that come up later in the select. I can't
figure out how to ignore these earlier messages. The Group
by command doesn't work because everything has to be the
same in the group which means I can't use posting_date and
other fields....
What I really want is a SQL statement that gets ALL the
recent messages, but only ONE message, the most recent one
from a thread and reverse orders them with the most recent
one first.
Suggestions appreciated.
TIA
-Bob