i developing php forum. forum uses 4 database tables: forum, thread, post, user. on landing page, have listing of forums, plus columns latest thread (achieved via join , inner join), total threas (simple count subquery), , total posts. i have fair-sized query returns of above, , working quite nicely - except total posts. the main query thus: select f.id forum_id, f.name forum_name, f.description, t.forum_id, #this subquery counts total threads in each forum (select count(t.forum_id) thread t t.forum_id = f.id ) total_threads, #this query counts total posts each forum (select count( p.id ) post p p.thread_id = t.id , t.forum_id = f.id group f.id) total_posts, t.id thread_id, t.name thread_name, t.forum_id parent_forum, t.user_id, t.date_created, u.id user_id, u.username forum f # join finds latest threads of each forum join (select forum_id, max(date_created) latest thread group forum_id) d on d.forum_id = f.id #and inner join grabs...