Home » RDBMS Server » Server Administration » Averaging rows in Oracle Query Builder
Averaging rows in Oracle Query Builder [message #374955] Fri, 13 July 2001 11:49 Go to next message
ewreliant
Messages: 1
Registered: July 2001
Junior Member
I am trying to average rows in 6 row intervals using the AVG(ALL num) function in another column.

How do I write this function. I don't understand what DISTINCT|ALL means and what I put in there
Re: Averaging rows in Oracle Query Builder [message #374958 is a reply to message #374955] Fri, 13 July 2001 15:24 Go to previous message
Sudhakar Atmakuru
Messages: 58
Registered: May 2001
Member
It is a syntax for AVG group function, using which you can average distinct (unique) values of column or all (including duplicates) values of column.
For ex:
SELECT AVG(TOT) FROM table_name;

It averages the values of TOT column which may have duplicates in it. If I want to average only the unique totals (eliminating the duplicates) of it, then i should give

SELECT AVG(DISTINCT TOT) FROM table_name;

For row intervals, you could use ROWID in SQL.

Hope this helps.
Previous Topic: Re: sql script
Next Topic: Re: Simple Update
Goto Forum:
  


Current Time: Sun Jul 07 16:59:06 CDT 2024