Q&A for people interested in the history and origins of science and mathematics
Select top 50 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'
select id from posts
group by postid
order by 'number of up votes' desc