Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Dec 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wink 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

  2. #2
    Senior Member rore's Avatar
    Join Date
    Nov 2005
    Location
    Montreal, CA
    Posts
    636
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    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

  3. #3
    Member
    Join Date
    Dec 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 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?

  4. #4
    Senior Member rore's Avatar
    Join Date
    Nov 2005
    Location
    Montreal, CA
    Posts
    636
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    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

  5. #5
    Member
    Join Date
    Dec 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  6. #6
    Senior Member rore's Avatar
    Join Date
    Nov 2005
    Location
    Montreal, CA
    Posts
    636
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    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

  7. #7
    Member
    Join Date
    Dec 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That seems to work great TYVM!!! Sorry I'm so rusty. TUX242

Similar Threads

  1. Select statements / Database schema & metadata
    By Cloudrider in forum Administrative Client
    Replies: 4
    Last Post: 10-30-2008, 12:50 PM
  2. TSM db space used by files
    By itcsge in forum TSM Server
    Replies: 2
    Last Post: 08-06-2008, 01:10 PM
  3. What happens to old space managed files?
    By tmcquaig in forum Hierarchical Storage Management
    Replies: 2
    Last Post: 02-12-2007, 01:59 AM
  4. Replies: 2
    Last Post: 06-30-2006, 11:49 AM
  5. Remove nodes & files space
    By brendanrtw in forum Capacity Planning
    Replies: 1
    Last Post: 04-21-2006, 11:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •