First off, thank you for all the assistance given to me by the folks here at the community.
I am hoping to pick your brains yet again:
Is there an easier way to calculate the Median with SQL 2008 (which is the version that I am in, based on the plan that I purchased with Caspio)?
Below is my code, which is not working:
WITH Cnt AS
(SELECT COUNT(*) AS cnt)
,RN AS
(SELECT AutoID, ROW_NUMBER() OVER (ORDER BY Annual_Salaries) AS myNum
FROM market_data
)
SELECT AVG(1.*Annual_Salaries) AS median
FROM RN JOIN Cnt
on myNum IN ((cnt+1)/2,(cnt+2)/2)
Any help will be put in the bank of 'never to be forgotten'.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
Elena
Hello all,
First off, thank you for all the assistance given to me by the folks here at the community.
I am hoping to pick your brains yet again:
Is there an easier way to calculate the Median with SQL 2008 (which is the version that I am in, based on the plan that I purchased with Caspio)?
Below is my code, which is not working:
Any help will be put in the bank of 'never to be forgotten'.
Elena
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.