okay. I'm sorry you didn't understand my question. I'm frustrated because I -am- trying to rethink my strategy and came here for help in that, only to be told nothing other than what I already knew. After rereading it it still seems clear to me, but I will try rephrasing. I apologize for whatever lack of proper terminology is contributing to my inability to communicate my problem to you.
I have two tables. one of them contains messages, the other one contains topics. There are many messages associated with one topic. Thus, the message table has a message ID, a topic ID with which the message is associated, and some other columns (the information I am interested in is the author ID). The topic table has a topic ID, which is the same as the first message ID in that topic (a primary key that will allow me to get the author of the original message), and also some other information.
I would like, in addition to retrieving the author of the original message, to retrieve the author of the last reply. Originally, every time a new message was added to a topic, I updated a "last reply ID" column in the database. However, I am adding an ignore feature, in which case the last reply to the thread is not necessarily the last one that a user will want to view. So, I need to select the last reply with a qualified query.
The problem is, as you know, that MySQL does not yet allow sub-selects, and it does not allow the syntax I demonstrated in my second post (and not just because of the missing comma). It fails to recognize lastReplyId as a value at that point, because at the time the query is run, the aggregate functions have not completed their calculations.
So what I want to know is: is there a way, without doing one query per result row, to retrieve the data about the last replies of each of these topics?