Bacula-users

Re: [Bacula-users] bconsole query for calculating client 7days utilization

2009-12-18 06:47:19
Subject: Re: [Bacula-users] bconsole query for calculating client 7days utilization
From: "Mike Holden" <bacula AT mikeholden DOT org>
To: "bacula-users" <bacula-users AT lists.sourceforge DOT net>
Date: Fri, 18 Dec 2009 11:43:32 -0000
vishal veerkar wrote:
> After trying some combination with other queries finally i got the break
> through...below query gives the output for All clients utilization in GB for
> specified time window...this may helpful for others
>
> :List storage used by client and pool after specified time window
> *Enter Start time in YYYY-MM-DD HH:MM:SS format:
> *Enter End time in YYYY-MM-DD HH:MM:SS format:
> SELECT Client.Name AS Client, Pool.Name as Pool,
>    sum(Job.JobFiles) as Files, sum(Job.JobBytes)/(1024*1024*1024) as
> TotalSizeGb
>  FROM Client, Job, Pool
>  WHERE Job.ClientID = Client.ClientID and Job.PoolID = Pool.PoolID
>  AND JobStatus='T'
>  AND Job.StartTime >= '%1'
>  AND Job.StartTime <= '%2'
>  GROUP by Client.ClientID
>  ORDER by Client.Name;

You still have Pool.Name listed in the SELECT list but not in the GROUP BY 
clause. I
would suggest (to give standard SQL code), that you change the "GROUP BY clause 
to
"GROUP BY Client.Name, Pool.Name". You might want to update the ORDER BY in the 
same
way.
-- 
Mike Holden

http://www.by-ang.com - the place to shop
for all manner of hand crafted items,
including Jewellery, Greetings Cards and Gifts



------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users