Q&A for professional and enthusiast programmers
SELECT datepart(YEAR,CreationDate)*100 + 100*(DATEpart(MONTH, CreationDate)/12.0) AS [Date], -- COUNT(*) AS Amount, -- 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 = 2 THEN 1 ELSE 0 END) / CAST(count(*) as float) AS percent_up_vote FROM Votes WHERE votetypeid in (2,3) GROUP BY DATEpart(MONTH, CreationDate),datepart(YEAR,CreationDate) ORDER BY date