Link to home
Start Free TrialLog in
Avatar of zonate_toaster
zonate_toasterFlag for United States of America

asked on

Max,Min,Average,Standard Deviation,Median Sql Query Oracle

I have many columns in the table,want to select distinct combination of Col A and Col B and Col C and peform calculation in Col D for each distinct combination of Col A,Col B and Col C.and calculate in Col C(Max,Min,Average,Median and Standard Deviation) Values.Please let me know how to write a query for it.

Ex is attached.

Template.xls
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Check out the analytic functions:

http://psoug.org/reference/analytic_functions.html

If you need help with any syntax given the data you provided, what are your expected results?
Avatar of zonate_toaster

ASKER

What you told me i did that:-
select distinct hostname,instance,order_type,max(latency_micro_sec) as Max_Latency,min(latency_micro_sec) as Min_Latency,avg(latency_micro_sec) as Aver_Latency,
stddev(latency_micro_sec) as Stddev_Latency from latency_info order by hostname;

Please help me get the function for median also,and when i execute this command i get not a single-group group function.Please help me to write the query.
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
TThank your for your prompt reply.