upvote% vs downvote% annually

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

select yr, ups, downs, 
round(100.0*downs/(ups+downs),1) as downPct,
round(100.0*ups/(ups+downs),1) as upPct
from (

select year(creationdate) as yr,
sum(case when votetypeid=2 then 1 else 0 end) as ups,
sum(case when votetypeid=3 then 1 else 0 end) as downs
from votes
where /* creationdate>getdate()-(365*3) and */ votetypeid in (2,3)
group by  year(creationdate)
) z
order by yr

Enter Parameters

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