 SELECT c.id, c.fullname, c.shortname, c.visible, c.timecreated,
                                      (SELECT SUM( f.filesize )
                                         FROM {files} f, {context} ctx
                                        WHERE ctx.id           = f.contextid
                                          AND ctx.contextlevel = 50
                                          AND ctx.instanceid   = c.id
                                      GROUP BY ctx.instanceid) AS coursesize,
                                      (SELECT SUM( f.filesize ) AS modulessize
                                         FROM {course_modules} cm, {files} f, {context} ctx
                                        WHERE ctx.id = f.contextid
                                          AND ctx.instanceid   = cm.id
                                          AND ctx.contextlevel = 70
                                          AND cm.course        = c.id
                                     GROUP BY cm.course) AS modulessize
                                 FROM {course} c
                                WHERE c.id > 1