Q&A about the site for serious players and enthusiasts of poker
DECLARE @MedianViewCount int SELECT @MedianViewCount = AVG(ViewCount) FROM ( SELECT ROW_NUMBER() Over (ORDER BY VIEWCOUNT ASC) RN_A, ROW_NUMBER() Over (ORDER BY VIEWCOUNT DESC) RN_D, ViewCount FROM posts WHERE postTypeID= 1) t WHERE RN_A IN (RN_D, RN_D - 1, RN_D + 1) SELECT AVG(cast(ViewCount as decimal)) Mean_ViewCount, @MedianViewCount Median_ViewCount, STDEV(cast(ViewCount as decimal)) StandardDevation_ViewCount FROM posts WHERE postTypeID= 1