select count(iif(VoteTypeId=2, 1, null))*100/count(*) Pct...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select count(iif(VoteTypeId=2, 1, null))*100/count(*) PctUpvotes, count(iif(VoteTypeId=3, 1, null))*100/count(*) PctDownvotes
from Votes v
join Posts p on p.Id=v.PostId and p.PostTypeId=2
where v.CreationDate > getdate()-90
and VoteTypeId in (2,3)

Enter Parameters

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