MySQL
-- Attachment statistic select p.pkey, p.pname, year(f.created) yr, count(f.id) as "# of files", min(f.filesize)/1024 as "min size (kb)", avg(f.filesize)/1024 as "average size(kb)", max(f.filesize)/1024 as "max size(kb)", sum(f.filesize)/(1024*1024) as "total size(mb)" from fileattachment f, project p, jiraissue i WHERE f.issueid = i.id AND i.project = p.id group by p.pkey, p.pname, yr;
Sample Result