Hot posts

0

Please login or register to vote for this query.

(click on this box to dismiss)

Robotics Meta

Q&A about the site for professional robotic engineers, hobbyists, researchers and students

-- Count: Number of posts:
-- TagNames: Tag names (split comma):
-- PostTypeId: Post type: Question (1), Answer (2):
-- VoteTypeId: Vote type: Upvote (2), Downvote (3):
-- UntilDate: Until creation date (default value is today):
-- SinceDate: Since creation date (default value is a month ago):

declare @today DATETIME = cast(getdate() as date)
declare @TwoMonthsAgo DATETIME = cast(dateadd(month, -5, getdate()) as date)

declare @count int = ##Count:int?100##
declare @tagnames varchar(max) = ##TagNames:string?CSS,flexBox##
declare @PostType int = ##PostTypeId:int?1##
declare @VoteType int = ##VoteTypeId:int?2##
declare @until DATETIME = ##UntilDate?@today##
declare @since DATETIME  = ##SinceDate?@TwoMonthsAgo##

select top (@count)
  count(v.PostId) as VoteCount,
  p.Score,
  v.PostId as [Post Link],
  p.CreationDate,
  p.Tags,
  p.Body
from votes v 
  inner join posts p on p.Id = v.PostId
  inner join posttags pt on pt.postid = p.id
  inner join tags t on t.id = pt.tagid
  cross join string_split(@tagnames, ',') tv
where
  p.PostTypeId = @PostType and
  v.VoteTypeId = @VoteType and
  p.CreationDate >= @since and
  p.CreationDate <=  @until and
  upper(t.tagname) = upper(tv.value)
group by
  p.CreationDate,
  p.Score,
  v.PostId,
  p.Body,
  p.Tags
order by
  p.Score desc

Enter Parameters

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