View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 08:52 AM
Paul Lautman
 
Posts: n/a
Default Re: Forum query without subselect

pillepop2003@yahoo.de wrote:
> Hey guys!
> I'm just coding a little forum application and have some trouble with
> my "thread-overview" page.
> I want to list a table with the following information:
>
> Thread_title | username_of_last_post | datetime_of_last_post
>
> My schema is as follows:
>
> thread (thread_id, thread_title, ...)
> post (post_id, thread_id, user_id, date_created, ...)
> user (user_id, name, ...)
>
> THE PROBLEM:
> As my provider is still using mysql4.0x without subselects, i want to
> do this in one query BUT I HAVE NO CLUE HOW TO DO IT!!! In general, it
> looks like a simple JOIN operation, but how do I get mysql to show
> only the username / datetime of THE LAST post of EACH thread???
>
> Any help is highly appreciated
> Thanks a lot!!
>
> Philipp


You need what I call the "Strawberry Query"
See the pattern for it in my response on this thread:
http://tinyurl.com/yex7s2


Reply With Quote