My median and average answer score at given date

3

Please login or register to vote for this query.

(click on this box to dismiss)

Reports median and average answer score. The MedianAnswerScore2 is more precise version of median.

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

declare @median int;
SELECT @median =  count(*) FROM Posts
select @median;
/*SELECT MAX(Score) 
               FROM (SELECT TOP 50 percent Score
                     FROM Posts as PU
                     WHERE PostTypeId = 2 and CommunityOwnedDate IS NULL 
                         and PU.OwnerUserId = ##UserId##
                     ORDER BY Score
                     ) as t;*/
/*
declare @median2 int;
set @median2 = @median +
 (             SELECT count(*) 
               FROM (SELECT TOP 50 percent Score
                     FROM Posts as PU
                     WHERE PostTypeId = 2 and CommunityOwnedDate IS NULL 
                         and PU.OwnerUserId = ##UserId##
                     ORDER BY Score
                     ) as t;
               WHERE Score = @median
 ); /* /
(SELECT count(*)
 FROM Posts as PU
 WHERE PostTypeId = 2 and CommunityOwnedDate IS NULL 
     and PU.OwnerUserId = ##UserId##
     and Score = @median
 )*/

*/
/*SELECT 
    Count(Posts.Id) AS Answers,
    @median AS MedianAnswerScore
FROM
    Posts
WHERE 
    PostTypeId = 2 and CommunityOwnedDate IS NULL and OwnerUserId = ##UserId##*/

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results