Select count(VoteTypeId) as 'total votes', SUM(CASE WHEN ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Meta Stack Overflow

Q&A about Stack Overflow

Select count(VoteTypeId) as 'total votes',
    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 postid=11227809

Enter Parameters

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