I built a custom forum for my site using MySQL. The listing page is essentially a table with the following columns: Topic, Last Updated, and
You may want to break it up into a set of subqueries (as inner queries). I'd need the schema to really play, but if you
SELECT t.id, t.name, MAX(COALESCE(r.date, t.date)) AS date, COUNT(r.id) AS replies
FROM (
SELECT (id, name, date)
FROM wp_pod_tbl_forum
WHERE topic_id = 0
) as t
LEFT OUTER JOIN
wp_pod_tbl_forum r
WHERE
r.topic_id = t.id
GROUP BY
t.id
ORDER BY
date DESC LIMIT 0,20;
that may help speed it up a little, it may not even be the best answer (errors may exist).
There are tons of ways to do it, but the most important thing to do when SQL tuning is to reduce each set as much as possible before performing an operation.