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)

The top 200 questions with the most views

Skeptics

Q&A for scientific skepticism

-- Questions with most views
-- The top 20 questions with the most views
DECLARE @To_Date datetime = dateadd(mm,3, CAST ('##StartDate##' as datetime)) 
DECLARE @From_Date datetime = CAST( '##StartDate##' as datetime)

Print 'from ' + format(@From_Date, 'D') + ' to ' + format(@To_Date, 'D')
/*
SELECT TOP 20 Posts.Id
AS [Post Link],
users.id as [User Link],
Posts.CreationDate,
Score,
ViewCount, 
FavoriteCount
FROM Posts 
inner join
users on
Posts.OwnerUserId = users.id
WHERE ClosedDate is null
      and Posts.CreationDate between @From_Date and @To_Date
ORDER BY ViewCount DESC
*/

SELECT TOP 20 Posts.Id
AS [Post Link],
users.id as [User Link],
Posts.CreationDate,
Score,
ViewCount, 
FavoriteCount
FROM Posts 
inner join
users on
Posts.OwnerUserId = users.id
WHERE ClosedDate is null
      and posttypeid = 1
      and Posts.CreationDate between @From_Date and @To_Date
ORDER BY Score DESC

Enter Parameters

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