Questions in a specific tag with highest score from anonymous feedback

1

Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers

Q&A for Drupal developers and administrators

SELECT TOP(##mum?500##)
  RANK() OVER(ORDER BY SUM(Case When pf.VoteTypeId = 2 Then 1 Else -1 End) DESC) AS Rank,
  pf.PostId as [Post Link],
  SUM(Case When pf.VoteTypeId = 2 Then 1 Else NULL End) AS UpFeedback,
  SUM(Case When pf.VoteTypeId = 3 Then 1 Else NULL End) AS DownFeedback,
  SUM(Case pf.VoteTypeId When 2 Then 1 WHEN 3 Then -1 End) AS Score
FROM
  PostFeedback pf INNER JOIN Posts p ON p.Id = pf.PostId
  INNER JOIN PostTags pt ON p.Id = pt.PostId
  INNER JOIN Tags t ON pt.TagId = t.Id
WHERE (t.TagName=##tagname:string?diophantine-equations##)
  AND (p.PostTypeId=1)
GROUP BY pf.PostId
ORDER BY SUM(Case When pf.VoteTypeId = 2 Then 1 Else -1 End) DESC

Enter Parameters

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