Questions with best score created within 3 month range

0

Please login or register to vote for this query.

(click on this box to dismiss)

Movies and TV

Q&A for movie and tv enthusiasts

DECLARE @From DATETIME = convert(DATETIME, '##StartDate?2017-07-01##')
DECLARE @To DATETIME = dateadd(mm, 3, @From)

SELECT TOP ##Count:int?50## Q.Id AS [Post Link], 
  Q.CreationDate AS Created, Q.Score AS [Question Score], 
  max(A.Score) AS [Max Answer Score], 
  Q.ViewCount AS Views, Q.FavoriteCount AS Favorited
FROM
  Posts Q
  LEFT JOIN Posts A ON A.ParentId = Q.Id
WHERE
  Q.ClosedDate IS NULL AND
  Q.PostTypeId = 1 AND
  Q.CreationDate BETWEEN @From AND @To
GROUP BY Q.Id, Q.CreationDate, Q.Score, Q.ViewCount, Q.FavoriteCount
ORDER BY Q.Score DESC

Enter Parameters

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