Here is the current query from my discussion board.
This works fine, but now I have a request to allow the user to order the list by ThreadName or LastPost. I've tried ORDER BY Max,LastPost, and MsgDatePosted. In the first two cases, I get an error that CF can't determine the value of the parameter, and in the last case, it diplays all messages, not just the date of the most recent post. This can't be that hard, but I don't know what to try next. Calista :-X
Jedi Knight,
Champion of the Force
Code:
<CFQUERY NAME="GetThreads" DATASOURCE="#Application.Datasource#">
SELECT ThreadID,
ThreadName,
ThreadDate,
ThreadForumID,
Count(MessageID) AS MessCount,
Max(MsgDatePosted) as lastpost
FROM ThreadTable,
MessageTable
WHERE ThreadID = MsgThreadID
AND ThreadForumID = '#Forum#'
GROUP BY ThreadForumID,
ThreadID,
ThreadName,
ThreadDate
ORDER BY ThreadName
</CFQUERY>
Jedi Knight,
Champion of the Force