Search the Community
Showing results for tags 'Statistical Calculations'.
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: 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'. Elena