I need to write the following query:
SELECT forum_threads.id AS id_thread,
forum_threads.topic,
forum_threads.date_created,
forum_posts.content,
CONCAT(users.first, ' ', users.last) AS author_name
FROM forum_threads,forum_posts,users
WHERE forum_threads.category_id=1
AND forum_threads.author_id=users.id
AND forum_posts.id=
(SELECT id FROM forum_posts WHERE thread_id=`id_thread` ORDER BY date_posted ASC LIMIT 0,1)
I'm not asking anyone to do the work for me. I just couldn't find anything in the reference that could do a query like this. Point me in the right direction and that should be everything I need.
I can get to the point where I need to the subquery, then I have no idea how to progress. Any ideas?
FYI: I want to use a Zend_Db_Select object because I'm sending it to a Zend_Paginator
Clarification of what the query is doing: Pulling all threads for a given forum category a long with the content of the first post.