Ok, hold on, I missed one. Sorry about that. This WILL work now.
PHP Code:
$attachs=$DB_site->query_first("
SELECT forum.title AS forum, COUNT(attachment.attachmentid) AS count, SUM(IF(thumbnail = '', 0, 1)) AS thumbs, SUM(IF(thumbnail = '', 1, 0)) AS files, SUM(attachment.filesize) AS bytes
FROM " . TABLE_PREFIX . "attachment AS attachment, " . TABLE_PREFIX . "post AS post, " . TABLE_PREFIX . "thread AS thread, " . TABLE_PREFIX . "forum AS forum
WHERE attachment.postid = post.postid
AND post.threadid=thread.threadid
AND forum.forumid=thread.forumid
AND forum.forumid=$forumid
GROUP BY thread.forumid
ORDER BY count DESC
");