LEFT JOIN post AS post ON(thread.threadid = post.threadid) LEFT JOIN post AS post ON(post.postid = thread.firstpostid)