>>>>> On Mon, 30 Jan 2006 11:51:45 -0500, Frank Sweetser <[EMAIL PROTECTED]> 
>>>>> said:
> 
> On Mon, Jan 30, 2006 at 03:15:54PM +0000, Martin Simmons wrote:
> > TotalBytes and TotalFiles don't work because the SchedTime is not unique and
> > clients can have multiple filesets (which are not unique either).  It also
> > counts non-backups jobs (restore, verify).
> > 
> > Maybe something this would be better (for TotalFiles):
> 
> Yup, your query works better - I had forgotten that a FileSet is not
> necessarily unique to a single client.  I had to tweak the query slightly to
> run on MySQL, though - am I correct is guessing that you're running 
> PostgresQL?
> If so, does this version work for you and produce the same results?
> 
> select sum(J1.JobFiles) from Job as J1 where
>  J1.JobId = ( select J2.JobId from Job as J2
>    where J2.Name = J1.Name
>    and J2.Type = 'B'
>    and J2.Level = 'F'
>    and J2.JobStatus = 'T'
>    order by J2.SchedTime desc
>    limit 1 );

Yes, that's good on PostgreSQL too.  I used "in" there before I realized it
needed sorting and limiting.

__Martin


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to