Tagged Zombie TimeSeries


Please login or register to vote for this query.

(click on this box to dismiss)

Motor Vehicle Maintenance and Repair Meta

Q&A about the site for mechanics and DIY enthusiast owners of cars, trucks, and motorcycles

declare @epoch as date = DateAdd(week, -1 - ##Weeks:int?52##, CURRENT_TIMESTAMP)

    select TOP ##TopTags:int?15##
           ROW_NUMBER() over (order by count(*) desc) as Rank,
           pt.TagId as TagId,
           t.TagName as TagName,
           count (*) as ZombieCount
    into #toptags
    from PostTags pt, Posts p, Tags t
    where (p.AnswerCount is null or p.AnswerCount = 0)
      and p.Id = pt.PostId
      and t.id = pt.TagId
      and p.PostTypeId = 1
      and p.CommunityOwnedDate is null
      and p.ClosedDate is null
    group by pt.TagId, t.TagName
    order by count(*) desc

select distinct DateAdd(day, 7 - DatePart(weekday, CreationDate), Convert(Date, CreationDate)) as WeekEnd
into #weekends
from Users
where CreationDate > @epoch

select WeekEnd,
       count (p.Id) as ZombieCount
from Posts p, PostTags pt, #weekends w, #toptags t
where p.CreationDate < WeekEnd
  and p.PostTypeId = 1
  and p.Id = pt.PostId
  and pt.TagId = t.TagId
  and p.CommunityOwnedDate is null
  and p.ClosedDate is null
  and not exists (
           select 1
           from Posts a
           where a.PostTypeId = 2
             and a.ParentId = p.Id
             and a.CreationDate < WeekEnd)
group by WeekEnd, TagName, Rank
order by WeekEnd, Rank

Enter Parameters

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