Nope, a join will do it. I've got it re-written..
old way: mysql things 1.10 seconds
new way: mysql things 0.09 seconds
Only problem is it joins the post table again which won't work if you have dotqueries turned on. It will take a little more re-writing to get it to work with dotqueries.
PHP Code:
// HACK POST PREVIEW
if($bbuserinfo['usergroupid']==6 and $showposts!="off") {
$previewselect="post.pagetext as pagetext,";
$previewjoin="LEFT JOIN post ON (thread.firstpostid = post.postid)";
}
// END PREVIEW
$threads=$DB_site->query("
SELECT $dotuserid $votequery $previewselect ".iif($foruminfo[allowicons],
'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid,
lastposter,thread.dateline,views,thread.iconid,
notes,thread.visible,sticky,votetotal,attach
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin $previewjoin
WHERE $threadids
ORDER BY sticky DESC, $sortfield $sqlsortorder
");
Then reference thread[pagetext] down below instead of running the query each time. Works like a charm without the extra db overhead, but like I said, will take a little tweaking to get it to go with dotqueries.