Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Median

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-09 : 17:16:33
Nithyanand writes "How to find a median value for a set fo data.I have found median function in books online. But it is not clear with examples and how to use that function. Could any can help me."

Lou
Yak Posting Veteran

59 Posts

Posted - 2002-03-09 : 19:36:30
I believe the median function is only available if you have sql enterprise edition / analysis services/ data warehouse thingy. Standard T-sql only has sum, max, min, avg, and count.

Go to Top of Page

yakoo
Constraint Violating Yak Guru

312 Posts

Posted - 2002-03-09 : 23:30:35
If I am correct Ken Henderson talks about Median aggregations in his book "The Guru's Guide to Transact-SQL" which can be found here http://www.sqlteam.com/store.asp



Go to Top of Page

Lou
Yak Posting Veteran

59 Posts

Posted - 2002-03-10 : 11:36:26
well, here is the simple definition of median. I think it should relatively painless to come up with a script for it. HTH.

Computation of Median
When there is an odd number of numbers, the median is simply the middle number. For example, the median of 2, 4, and 7 is 4.

When there is an even number of numbers, the median is the mean of the two middle numbers. Thus, the median of the numbers 2, 4, 7, 12 is (4+7)/2 = 5.5.


Edited by - lou on 03/10/2002 11:38:06
Go to Top of Page
   

- Advertisement -