--- /dev/null
+-- report number of files and staticics for each backup
+
+select
+ hosts.name as host,
+ shares.name as share,
+ backupnum as num,
+ backups.date as backup_date,
+ backups.type as type,
+ min(files.date) as from,
+ max(files.date) as to,
+ count(*) as files,
+ sum(files.size) as size,
+ sum(backups.size) as backup_size
+from files
+join shares on files.shareid=shares.id
+join hosts on shares.hostid = hosts.id
+join backups on shares.hostid = backups.hostid
+ and files.backupnum = backups.num
+ and shares.id = backups.shareid
+group by shares.name, hosts.name, backupnum, backups.date, backups.type
+order by backups.date;