Questions with low score and high viewcounts

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT TOP 500
  Posts.Id AS [Post Link],
  Posts.CreationDate,
  Posts.Score,
  Posts.ViewCount,
  ROUND(Posts.ViewCount / CAST(DATEDIFF(month,Posts.CreationDate,GETDATE()) AS DECIMAL), 0) AS 'Views/mo',
  PostHistory.CreationDate AS 'ProtectedDate',
  CASE WHEN Posts.ClosedDate IS NOT NULL THEN 'Yes' ELSE NULL END AS 'Closed',
  COUNT(*) AS 'Answers',
  COUNT(CASE WHEN PostsWithDeleted.DeletionDate IS NOT NULL THEN 1 ELSE NULL END) AS 'Deleted'
FROM Posts
LEFT JOIN PostsWithDeleted ON Posts.Id = PostsWithDeleted.ParentId
LEFT JOIN PostHistory ON Posts.Id = PostHistory.PostId
                     AND PostHistory.PostHistoryTypeId = 19 -- Question Protected
WHERE Posts.Score <= ##MaxScore?2##
GROUP BY Posts.Id, Posts.CreationDate, Posts.Score, Posts.ViewCount,
         PostHistory.CreationDate, Posts.ClosedDate
ORDER BY Posts.ViewCount DESC

Enter Parameters

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