Code:
SELECT t.threadid, t.title, t.firstpostid, t.lastpost, t.replycount, t.forumid, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, p.pagetext
FROM " . TABLE_PREFIX . "thread t
LEFT JOIN " . TABLE_PREFIX . "post p ON p.postid = t.firstpostid
AND t.open = '1'
AND t.visible = '1'
AND t.forumid NOT IN (36,37,77,173,172)
ORDER BY t.dateline DESC
LIMIT 0 , 10