Hi Matt!
I try your last select command but just only add stgpools.maxscratch in
the end of your line.
select stgpools.stgpool_name, stgpools.maxscratch,count(*) from
volumes,stgpools where volumes.stgpool_name in (select stgpool_name from
stgpools where devclass='ULTRIUM1') group by stgpools.stgpool_name,
stgpools.maxscratch
Result :
STGPOOL_NAME MAXSCRATCH Unnamed[3]
------------------ ----------- -----------
ARCHIVEPOOL 11
BACKUPPOOL 11
COPYPOOL 3 11
DISKPOOL 11
SPACEMGPOOL 11
TAPEPOOL 11 11
/Christian
-----Ursprungligt meddelande-----
Fran: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU]For Warren,
Matthew (Retail)
Skickat: den 16 januari 2004 14:30
Till: ADSM-L AT VM.MARIST DOT EDU
Amne: Re: SQL query
Hi Christian,
Sorry, I may not have worded my problem very clearly. Using the
follwing tables and columns;
TABLENAME COLNAME
------------------ ------------------
STGPOOLS STGPOOL_NAME
STGPOOLS DEVCLASS
STGPOOLS MAXSCRATCH
VOLUMES STGPOOL_NAME
I would like to find out;
For every stgpool that has a device class of ultrium1, I need to know
the stgpool name, the maxscratch value ((IE: the maximum number of
scratch tapes alolwed for use in the pool)) for the stgpool and a count
of how many volumes are in the stgpool
In case it helps (I doubt it :/ ) heres a copy of the latest attempt
I made at trying to work it out;
tsm: CARSINGTON>select stgpools.stgpool_name, stgpools.maxscratch,
count(*) from volumes where stgpool_name in (select stgpool_name from
stgpools where devclass='ULTRIUM1') group by stgpool_name
ANR2940E The reference 'STGPOOLS.STGPOOL_NAME' is an unknown SQL column
name.
|
.......V.......................................................
select stgpools.stgpool_name, stgpools.maxscratch, count(*) fro
ANS8001I Return code 3.
tsm: CARSINGTON>select stgpools.stgpool_name, stgpools.maxscratch,
count(*) from volumes,stgpools where stgpool_name in (select
stgpool_name from stgpools where devclass='ULTRIUM1') group by
stgpool_name
ANR2941E The column reference 'STGPOOL_NAME' matches more than one SQL
column name.
|
.........................V.....................................
m volumes,stgpools where stgpool_name in (select stgpool_name f
ANS8001I Return code 3.
tsm: CARSINGTON>select stgpools.stgpool_name, stgpools.maxscratch,
count(*) from volumes,stgpools where volumes.stgpool_name in (select
stgpool_name from stgpools where devclass='ULTRIUM1') group by
stgpool_name
ANR2941E The column reference 'STGPOOL_NAME' matches more than one SQL
column name.
|
...................................................V...........
from stgpools where devclass='ULTRIUM1' ) group by stgpool_name
ANS8001I Return code 3.
tsm: CARSINGTON>select stgpools.stgpool_name, stgpools.maxscratch,
count(*) from volumes,stgpools where volumes.stgpool_name in (select
stgpool_name from stgpools where devclass='ULTRIUM1') group by
stgpools.stgpool_name
ANR2938E The column 'MAXSCRATCH' is not allowed in this context; it must
either be named in the GROUP BY clause or be nested within an aggregate
function.
|
..............................V................................
select stgpools.stgpool_name, stgpools.maxscratch, count(*) fro
ANS8001I Return code 3.
tsm: CARSINGTON>pull hair, gnash teeth
-----Original Message-----
From: Christian Svensson
<christian.svensson AT CRISTIE DOT SE>@EME
Sent: Friday, January 16, 2004 1:06 PM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: SV: SQL query
Hi Matt!
Im not sure what you looking for.
But maybe this helps you...
Replace YOUR LTOCLASS NAME with the real Device class
name.
select stgpool_name,count(*) as "Maxscratch" from
volumes where
devclass_name='YOUR LTOCLASS NAME'
/Christian
-----Ursprungligt meddelande-----
Fran: ADSM: Dist Stor Manager
[mailto:ADSM-L AT VM.MARIST DOT EDU]For Warren,
Matthew (Retail)
Skickat: den 16 januari 2004 13:03
Till: ADSM-L AT VM.MARIST DOT EDU
Amne: SQL query
Hallo TSMers,
I think I've mentioned before, my SQL's not so hot. I'm
practising all I
can, although, I can't seem to crack this one, or others
like it;
I would like to find out (with SQL if possible, I could
do it via script
etc.. easy enough) ;
For every stgpool that has a device class of ultrium1;
the stgpool name,
the maxscratch value for the stgpool and how many
volumes are in that
stgpool.
I'm incredibly hazy on things like joins, despite having
read around the
subject, and TSM only implements a cut-down SQL. It is,
to get
technical, doing my head in.
Thanks,
Matt.
___________________________ Disclaimer Notice
__________________________
This message and any attachments are confidential and
should only be
read
by those to whom they are addressed. If you are not the
intended
recipient, please contact us, delete the message from
your computer and
destroy any copies. Any distribution or copying without
our prior
permission is
prohibited.
Internet communications are not always secure and
therefore the Powergen
Group does not accept legal responsibility for this
message. The
recipient is responsible for verifying its authenticity
before acting on
the
contents. Any views or opinions presented are solely
those of the author
and do not necessarily represent those of the Powergen
Group.
Registered addresses:
Powergen UK plc, 53 New Broad Street, London, EC2M 1SL
Registered in England & Wales No. 2366970
Powergen Retail Limited, Westwood Way, Westwood
Business Park,
Coventry CV4 8LG.
Registered in England and Wales No: 3407430
Telephone +44 (0) 2476 42 4000
Fax +44 (0) 2476 42 5432
|