Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Average of grouped fields?

Status
Not open for further replies.

aks2trip

Technical User
May 29, 2003
13
0
0
CA
Hi,
I have a table that contains data as follows:

SYSTEM MOUNT KB_USED KB_TOTAL

host_1 / 1000 30000
host_1 / 1500 30000
host_1 /apps 1092 234343
host_1 /apps 7266 234343
host_2 / 4598 553444
host_2 / 4545 553444
host_2 /opt 3435 435345
host_2 /opt 4534 435345

What i want is, something like this

SYSTEM MOUNT AVG(KB_USED/KB_TOTAL)*100

host_1 / 4.166
host_1 /apps 1.78
host_2 / 0.82
host_2 /opt 0.91


How do I do this? Basically I want them grouped by mount per system.
Any help would be appreciated!!
Thanks
 
Code:
select SYSTEM
     , MOUNT
     , AVG(KB_USED/KB_TOTAL)*100 
  from atable
group
    by SYSTEM
     , MOUNT



r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top