Can anyone help me translate this to 3.5? I used this on 3.0 and it worked as designed. But something has changed as now attached thumbails show up as files with this query. I want to be able to pull out the amount of images and the amount of files.
PHP Code:
$attachs=$db->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
");