SELECT TOP 50 OwnerUserId, AVG(Score) AS MedianScore FROM (

0

Please login or register to vote for this query.

(click on this box to dismiss)

Vegetarianism

Q&A for those committed to a vegan or vegetarian lifestyle and anyone interested in learning more

SELECT TOP 50
   OwnerUserId,
   AVG(Score) AS MedianScore
FROM
(
   SELECT
      OwnerUserId,
      Score,
      ROW_NUMBER() OVER (
         PARTITION BY OwnerUserId
         ORDER BY Score ASC) AS RowAsc,
      ROW_NUMBER() OVER (
         PARTITION BY OwnerUserId
         ORDER BY Score DESC) AS RowDesc
   FROM Posts
) x
WHERE 
   RowAsc IN (RowDesc, RowDesc - 1, RowDesc + 1)
GROUP BY OwnerUserId
ORDER BY MedianScore DESC

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results