Q&A for people interested in the history and origins of science and mathematics
Select 'http://stackoverflow.com/posts/'+CONVERT(VARCHAR(19),postid)+'/revisions', 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 and posts.closeddate is null) group by postid