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)

Aviation

Q&A for aircraft pilots, mechanics, and enthusiasts

select    SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS [Up Votes],    
    SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS [Down Votes],    
    (CAST(SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS float) / CAST(SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS float)) 
   AS [Up Votes to Down Votes]
from    Votes v inner join Posts p on v.PostId=p.Id

Enter Parameters

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