I got it; however it takes 3.10 sec to execute. If you're going to use it I strongly suggest you make it cache itself daily or so.
[sql]
SELECT COUNT(p.postid), SUM(LENGTH(a.filedata)), f.title
FROM post p, thread t, forum f, attachment a
WHERE a.attachmentid = p.attachmentid AND t.threadid = p.threadid
AND f.forumid = t.forumid AND p.attachmentid > 0
GROUP BY f.forumid;
[/sql]
I'm sure it can be done with JOINs, too, but I don't know how.
|