Site Activity and VoteGraph

0

Please login or register to vote for this query.

(click on this box to dismiss)

Plot the site activity by voting, questions, answers and comments, aggregated per week.

Poker Meta

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

with Voting as (
select DATEADD(DAY, 0 - DATEPART(WEEKDAY, v.CreationDate), v.CreationDate) as YearMon,
       case when p.PostTypeId = 1 then 'Q' else 'A' end + vt.Name as Series,
       1 as Vote
    from Posts p,
         Votes v,
         VoteTypes vt
    where p.Id = v.PostId
      and v.VoteTypeId = vt.Id
)
select *
from Voting
pivot (
    sum(Vote)
    for Series in ([QUpMod],[QDownMod],[QFavorite],[AUpMod],[ADownMod],[AAcceptedByOriginator]))
    as Pivoted
where YearMon >= DATEADD(WEEK, -60, CURRENT_TIMESTAMP) -- previous 60 months.
  and YearMon < DATEADD(DAY, -7, CURRENT_TIMESTAMP) -- ignore most recent week.
order by YearMon

Enter Parameters

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