Votes per year

0

Please login or register to vote for this query.

(click on this box to dismiss)

Amateur Radio

Q&A for amateur radio enthusiasts

SELECT 
  Votes.Year,
  FORMAT(TotalVotes,'0,,.00 M') as Votes, 
  FORMAT(TotalPosts,'0,,.00 M') as Posts,
  ROUND((CAST(TotalVotes as float) / CAST(TotalPosts as float)), 2)  AS VotesPerPost
FROM (
  SELECT 
    YEAR(CreationDate) AS Year, 
    COUNT(*) AS TotalVotes
  FROM Votes
  GROUP BY YEAR(CreationDate)
) Votes
JOIN (
  SELECT 
    YEAR(CreationDate) AS Year, 
    COUNT(*) AS TotalPosts
  FROM Posts
  GROUP BY YEAR(CreationDate)
) Posts
ON(Votes.Year = Posts.Year)
ORDER BY Year

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results