Hi 

I rewrote a sql command from the /opt/bacula/scripts/query.sql: 

# 11 
:List total files/bytes by Volume 
SELECT count(*) AS Jobs,sum(JobFiles) AS Files,sum(JobBytes) AS 
Bytes,VolumeName 
FROM Job,JobMedia,Media 
WHERE JobMedia.JobId=Job.JobId 
AND JobMedia.MediaId=Media.MediaId 
GROUP by VolumeName; 

Which was miscalculating the values of each column 

This is the version that works: 
# 11 
:List total files/bytes by Volume 
SELECT count(*) AS Jobs,sum(JobFiles) AS Files,sum(JobBytes) AS 
Bytes,VolumeName 
FROM (SELECT DISTINCT Jobmedia.JobId, JobFiles, JobBytes, VolumeName 
FROM Job,JobMedia,Media 
WHERE JobMedia.JobId=Job.JobId 
AND JobMedia.MediaId=Media.MediaId) AS f 
GROUP BY VolumeName 
ORDER BY VolumeName; 

I would like someone to test the code. 
I don't know how to send it to the people who maintain the query.sql file. 

Giuseppe 

--------------------------------------------------
[PT] Texto confidencial para uso exclusivo do destinat�rio. N�o o divulgue e 
apague-o imediatamente se o recebeu por engano.
[EN] <i>This is a confidential text to be exclusively used by the recipient. Do 
not disclose it to anybody and delete it immediately if you received it by 
mistake.
[ES] <i>Texto confidencial para uso exclusivo del destinatario. Si usted lo 
recibi� por error no lo divulgue y excl�yalo inmediatamente.
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to