Votes per post

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

with all_posts as (
select count(*) post_count, 
       sum(isnull(cast(ViewCount as bigint), 0)) view_count
from Posts 
),

all_votes as(
select count(*) vote_count
from Votes 
where VoteTypeId in (1,2,3)
)

select cast(vote_count as float)/post_count votes_per_post, 
       post_count, 
       view_count
from all_posts,
     all_votes

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached