No function is built in. Median is always a interesting part of any advanced
SQL books. Try Ken Handerson's "Guru's Guide ..." or Joe Celko's "SQL for
Smarties" or both.
6 million rows is not too bad, it shouldn't take more then a second to do
the job.
Gary Xu
-----Original Message-----
From: William Markham [mailto:William.Markham@p...]
Sent: Wednesday, February 06, 2002 11:04 AM
To: sql language
Subject: [sql_language] Is there a quick way to find the median?
I need to find the median (not mean) of a colomn of about 6 million rows.
I am using SQL server 2000. Is there a sproc or aggregate that will do
this? I can't seem to find one.
Thanks
Bill
William.Markham@p...
$subst('Email.Unsub').
This electronic message transmission, including any attachments, contains information from PacifiCare Health Systems Inc. which may
be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not
the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is
prohibited.
If you have received this electronic transmission in error, please notify the sender immediately by a "reply to sender only" message
and destroy all electronic and hard copies of the communication, including attachments.