Questions with low score answers (from high rep users)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Tries locating hidden gems by searching for answers by high rep users which has low score. To help decide score level it also lists max and average score on that question. It does however _not_ list the user, as we don't want to actually focus on the users when looking for hidden gems, but more to revisit and up-vote worthy answers.

Code Review

Q&A for peer programmer code reviews

-- Limit: Max number of posts
-- ReputationLimit: Lower reputation limit
-- tag: Tag of question "Use % for wildcard in part of tag"
-- highestScore: Highest answer score
DECLARE @reputationLimit AS INT = ##ReputationLimit:int?5000##;
DECLARE @highestScore AS INT = ##highestScore:int?5##;
DECLARE @tag as NVARCHAR(60) = ##tag:string? ##;

SELECT TOP ##Limit:int?100##
  q.Id AS [Post Link],
  a.CreationDate,
  a.Score,
  q.MaxAns,
  q.AvgAns,
  q.Tags
FROM Posts a
  JOIN Users u ON a.OwnerUserId = u.Id
  JOIN (
  SELECT q.Id, q.Tags, AVG(a.Score) AvgAns, MAX(a.Score) MaxAns
    FROM Posts q
    JOIN Posts a ON a.ParentId = q.Id
    WHERE q.AcceptedAnswerId IS NULL
    GROUP BY q.Id, q.Tags
  ) q
  ON a.ParentId = q.Id
WHERE (u.Reputation > @reputationLimit)
  AND a.Score <= @highestScore
  -- AND q.MaxAnswerScore = 0
  AND (@tag = '' or q.tags like '%<'+@tag+'>%')
ORDER BY a.CreationDate DESC

Enter Parameters

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