Results 1 to 7 of 7
-
01-26-2009, 02:45 PM #1Member
- Join Date
- Dec 2004
- Posts
- 32
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Need Select In Certain Domains For Space/GB & # Of Files
My select statement syntax must be incorrect. I am trying to get the number of files and space in GB for all but a specific domain and I am using a <> clause for the one I want to exclude, I also need to do this select run exclusively for the excluded domain itself, here is what i am using:
SELECT node_name where node_name<>'YELLOW',CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB", SUM(num_files)as"Number of files" FROM occupancy GROUP BY node_name
SELECT node_name from nodes where node_name='YELLOW',CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB", SUM(num_files)as"Number of files" FROM occupancy GROUP BY node_name
but this one below seems to work:
SELECT node_name,CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB", SUM(num_files)as"Number of files" FROM occupancy GROUP BY node_name
and this seems to work for the not equal to part of the domain node listing:
SELECT node_name from nodes where node_name<>'YELLOW'
Help Anyone!!!
Thanks,
TUX242
-
01-26-2009, 03:09 PM #2Senior Member
- Join Date
- Nov 2005
- Location
- Montreal, CA
- Posts
- 636
- Thanks
- 0
- Thanked 4 Times in 4 Posts
Hi,
You have to put the 'where' after the 'from' in your SQL statements.
Like your query that works:
SELECT node_name from nodes where node_name<>'YELLOW'
Rudy
-
01-26-2009, 03:29 PM #3Member
- Join Date
- Dec 2004
- Posts
- 32
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Pasted wrong example but here is what i get..
SELECT node_name from nodes where node_name<>'YELLOW',CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB",SUM(num_files)as"Number of files" FROM occupancy GROUP BY node_name
ANR2908E Unexpected SQL punctuation token - ','.
|
.................................................. ....V........
SELECT node_name from nodes where node_name<> 'YELLOW' ,CAST(FLO
ANS8001I Return code 3.
So maybe its my punctuation?
-
01-26-2009, 03:38 PM #4Senior Member
- Join Date
- Nov 2005
- Location
- Montreal, CA
- Posts
- 636
- Thanks
- 0
- Thanked 4 Times in 4 Posts
Your sql statement is invalid.
You have two 'from' in your statement, and you have mixed the what you want to obtain (SELECT) with the condition (WHERE).
I think you want to do this:
SELECT node_name,CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB",SUM(num_files)as"Number of files" FROM occupancy where node_name<>'YELLOW' GROUP BY node_name
Take a look at this: http://www.firstsql.com/tutor2.htm
Hope this helps,
Rudy
-
01-26-2009, 03:51 PM #5Member
- Join Date
- Dec 2004
- Posts
- 32
- Thanks
- 0
- Thanked 0 Times in 0 Posts
I pasted wrong twice, time to start over, I am looking for a specific domain_name to be excluded not node_name...
SELECT node_name,CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB",SUM(num_files)as"Number of files" FROM occupancy where domain_name<>'YELLOW' GROUP BY node_name
ANR2940E The reference 'DOMAIN_NAME' is an unknown SQL column name.
|
..........................V....................... .............
les" FROM occupancy where domain_name<> 'YELLOW' GROUP BY node_n
ANS8001I Return code 3.
-
01-26-2009, 04:03 PM #6Senior Member
- Join Date
- Nov 2005
- Location
- Montreal, CA
- Posts
- 636
- Thanks
- 0
- Thanked 4 Times in 4 Posts
Voila!:
SELECT node_name,CAST(FLOAT(SUM(physical_mb)) / 1024 AS DEC(8,2))as "Space in GB",SUM(num_files)as"Number of files" FROM occupancy where node_name not in (select node_name from nodes where domain_name='YELLOW') GROUP BY node_name
Rudy
-
01-26-2009, 06:16 PM #7Member
- Join Date
- Dec 2004
- Posts
- 32
- Thanks
- 0
- Thanked 0 Times in 0 Posts
That seems to work great TYVM!!! Sorry I'm so rusty. TUX242
Similar Threads
-
Select statements / Database schema & metadata
By Cloudrider in forum Administrative ClientReplies: 4Last Post: 10-30-2008, 12:50 PM -
TSM db space used by files
By itcsge in forum TSM ServerReplies: 2Last Post: 08-06-2008, 01:10 PM -
What happens to old space managed files?
By tmcquaig in forum Hierarchical Storage ManagementReplies: 2Last Post: 02-12-2007, 01:59 AM -
Need Script to show # files inspected & # files backed up in one 24hr period
By gravesm in forum ScriptingReplies: 2Last Post: 06-30-2006, 11:49 AM -
Remove nodes & files space
By brendanrtw in forum Capacity PlanningReplies: 1Last Post: 04-21-2006, 11:29 AM


Reply With Quote
