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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting an Average from a TOP N Query?

Status
Not open for further replies.

mtl77

Programmer
May 27, 2003
31
CA
Does someone know how to get an average from a TOP n query like the following?


SELECT TOP 10 myColoum FROM myTable Where tableID = aValue Order by myColoum.

Any help would be greatly appreciated.

 
Try~~

select avg(mycoloum) as average from (SELECT TOP 10 myColoum FROM myTable Where tableID = aValue Order by myColoum) B


 
Great that works perfectly, Thanks for the help ClaireHsu!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top