Keleth
05-17-2009, 11:31 PM
I was hoping I could get some help with a small query that I can't seem to figure out, probably because I'm still learning mySQL. I'm writing a mini-forum, which I got help with here a few weeks ago. Now I'm trying to optimize some of the code, and I've run into this:
On the page listing the threads, I'm posting the number of posts in the thread and the last poster with date/time. So in my table of posts, I need to extract the number of posts on one threadID, as well as the last posterID, which can be joined on the table of users to get the username, and the date posted.
Right now I have two queries, one which pulls the number of posts and the other that pulls the last post details. Is there a way to make them one query? Or should I be using 2?
On the page listing the threads, I'm posting the number of posts in the thread and the last poster with date/time. So in my table of posts, I need to extract the number of posts on one threadID, as well as the last posterID, which can be joined on the table of users to get the username, and the date posted.
Right now I have two queries, one which pulls the number of posts and the other that pulls the last post details. Is there a way to make them one query? Or should I be using 2?