SQL MEDIAN for Age Ranges

using sql server 2000

I am wondering how to calculate the Median from a table (Table1) that is grouped by Age ranges:

e.g.

Table1
Value    Age

100      16
100      16
50        20
300      17
200      22
150      23
250      24

What would be the code to display the MEDIAN like this:
Age Range   MEDIAN
< 21             200
21 < 25         225


NOTE:
< 21 means less than age of 21
21 < 25 means greater than equal to 21 but less than 25
JCTDDAsked:
Who is Participating?
 
radcaesarCommented:
WHERE RowNum IN((Count + 1) / 2, (Count + 2) / 2)
0
 
JCTDDAuthor Commented:
thanks I will try them out
(I did find a few examples on the net but thought there might be another way)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.