The Table:
(`post_id`, `forum_id`, `topic_id`, `post_time`) (79, 8, 4, \'2012-11-19 06:58:08\'); (80, 3, 3, \'2012-11-19 06:58:42\'), (81, 9, 9, \'2012-11-1
This will also work fine for you.
SELECT * FROM ( SELECT post_id, forum_id, topic_id FROM posts ORDER BY post_time DESC LIMIT 5 ) customeTable GROUP BY topic_id