Various types of votes per month

1

Please login or register to vote for this query.

(click on this box to dismiss)

Emacs

Q&A for those using, extending or developing Emacs

SELECT
  eomonth(CreationDate),
  COUNT(Id) AS [All Votes],
  SUM(Case When VoteTypeId=2 Then 1 Else 0 End) AS UpVotes,
  SUM(Case When VoteTypeId=3 Then 1 Else 0 End) AS DownVotes,
  SUM(Case When VoteTypeId IN (2,3) Then 1 Else 0 End) AS [Up and Down],  
  SUM(Case When VoteTypeId=1 Then 1 Else 0 End) AS Accepted,
  SUM(Case When VoteTypeId=5 Then 1 Else 0 End) AS Bookmarked,
  SUM(Case When VoteTypeId=6 Then 1 Else 0 End) AS [Close],
  SUM(Case When VoteTypeId=8 Then 1 Else 0 End) AS Reopen,
  SUM(Case When VoteTypeId=10 Then 1 Else 0 End) AS [Delete],
  SUM(Case When VoteTypeId=11 Then 1 Else 0 End) AS Undelete,
  SUM(Case When VoteTypeId=16 Then 1 Else 0 End) AS Approve
FROM Votes
WHERE (CreationDate >= '##Date1?2019-01-01##') AND (CreationDate <= '##Date2?2022-01-01##')
GROUP BY eomonth(CreationDate)
ORDER BY eomonth(CreationDate)

Enter Parameters

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