Votes per post broken down

0

Please login or register to vote for this query.

(click on this box to dismiss)

Server Fault

Q&A for system and network administrators

SELECT 
  COUNT(v.id) as votes, 
  COUNT(p.id) as posts,
  CAST(
    CAST(COUNT(v.id) as DECIMAL(10,3))
    / 
    CAST(COUNT(p.id) as DECIMAL(10,3))
  as DECIMAL(10,3)) as voteweight
  
FROM votes v
left join posts p
  on p.id = v.postid
where v.VoteTypeId in ('2', '3')

Enter Parameters

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