select sum(case when votetypeid = 2 then 1 else 0 end) , ...

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 sum(case when votetypeid = 2 then 1 else 0 end)
     , sum(case when votetypeid = 3 then 1 else 0 end)
     , min(creationdate)
     , max(creationdate)
     , postid
from votes
group by postid

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results