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

MEDIAN Function/Stored Procedure

Status
Not open for further replies.

michaelkrauklis

Programmer
Dec 5, 2001
226
US
Is there any way to create a funciton or stored procedure that can take a result set and return the median? Eg:
Code:
select company, MEDIAN(salary)
from jobs
group by company
The main problem is passing a result set to a function or stored procedure. Is this possible? For efficiency purposes I can't pull the data out and then calculate the median, and I'd rather not do the query multiple times and use a cursor to pull out the medians for each grouping. Any help will be greatly appreciated.
MYenigmaSELF:-9
myenigmaself@myenigmaself.gaiden.com
"If debugging is the process of removing bugs, then programming must be the process of putting them in." --Dykstra
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top