What are the most viewed questions for a given multiple tags with time range?

2

Please login or register to vote for this query.

(click on this box to dismiss)

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

declare @TagString1 nvarchar(25) = ##tagName1:string##
declare @TagString2 nvarchar(25) = ##tagName2:string##
declare @TagString3 nvarchar(25) = ##tagName3:string##
declare @TagString4 nvarchar(25) = ##tagName4:string##
declare @TagString5 nvarchar(25) = ##tagName5:string##
declare @TagString6 nvarchar(25) = ##tagName6:string##

select TOP ##ResultSize## ViewCount, Id AS [Post Link]
from Posts 
where Id in
  (
    select PostId 
    from PostTags 
    where TagId IN (
    (
      select Id 
      from Tags 
      where TagName IN (@TagString1,@TagString2,@TagString3,@TagString4,@TagString5,@TagString6)
      ))
  )
  AND CreationDate > GETDATE() - ##Days##
  AND CreationDate < GETDATE() - ##Olddays##
Group by ViewCount, Id
ORDER by ViewCount DESC

Enter Parameters

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