ADSM-L

Re: Having a little trouble with a simple SQL Query - Please help!

2001-09-21 14:21:00
Subject: Re: Having a little trouble with a simple SQL Query - Please help!
From: Andrew Raibeck <storman AT US.IBM DOT COM>
Date: Fri, 21 Sep 2001 11:21:10 -0700
Hmmmmm.... well, if you are trying to roll up activity by node, then
displaying the start and end times doesn't make much sense, although they
can be used to filter the activity you want to report on.

If I am guessing your intent correctly, then the following should do the
trick:

select entity as Node, sum(affected) as Files_Backed_Up, sum(bytes) as
Total_Bytes
   from summary
   where activity='BACKUP' and start_time >= current_timestamp - 1 day
   group by entity

Note: this example uses "start_time" as the time filter. You might want
"end_time", depending on your needs.

Regards,

Andy

Andy Raibeck
IBM Tivoli Systems
Tivoli Storage Manager Client Development
Internal Notes e-mail: Andrew Raibeck/Tucson/IBM@IBMUS
Internet e-mail: storman AT us.ibm DOT com

The only dumb question is the one that goes unasked.
The command line is your friend.
"Good enough" is the enemy of excellence.




Yanki Yuksel <Yanki.Yuksel AT TAS.ALCATEL DOT CA>
Sent by: "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>
09/21/2001 10:59
Please respond to "ADSM: Dist Stor Manager"


        To:     ADSM-L AT VM.MARIST DOT EDU
        cc:
        Subject:        Having a little trouble with a simple SQL Query - 
Please help!



Hi guys,

I have typed this query, which works fine, but I need to be able to do
more.  First off here is the select command :

select distinct entity as Node, activity as Activity, start_time
as Start, end_time as End, affected as Files_Backed_up, bytes as
Total_Bytes fro
m summary where activity = 'BACKUP'

What I would like to do is also group this by the entity so that I
basically only receive one instance of the node.  Plus I would like to be
able to select only the information that pertains to current day - 1
(yesterday).

If anyone has any ideas I would love to hear them.  I have tried to add
the
group by entity after the where statement but it tells me that I cannot
have the activity, start_time, end_time, affected and bytes columns in the
query unless I place them within an aggregate function.

Thank you,

Yanki Yuksel
_____________________________
Yanki Yuksel
Sr. Systems/Network Administrator
Alcatel Canada
1235 Ormont Drive
Weston, Ontario, Canada
M9L 2W6
Tel:  (416) 742-3900 ext 5767
Fax: (416) 742-9088
e-mail : Yanki.Yuksel AT tas.alcatel DOT ca
_____________________________
<Prev in Thread] Current Thread [Next in Thread>