Q&A for people interested in the history and origins of science and mathematics
Select top 10 postid as [Post Link], SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS 'number of up votes', SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS 'number of down votes' From PostFeedback where exists( select id from posts where posts.id=postfeedback.postid ) group by postid order by 'number of up votes' desc