What is the average question score per view?

0

Please login or register to vote for this query.

(click on this box to dismiss)

http://meta.stackexchange.com/questions/279418/what-is-the-average-question-score-per-view/279421#279421

Mathematics

Q&A for people studying math at any level and professionals in related fields

select sum(cast(scores as bigint)) as score
    ,  sum(cast(views as bigint)) as views
    ,  sum(cast(upvotes as bigint)) as upvotes
    , sum(cast(downvotes as bigint)) as downvotes
    , cast(sum(cast(upvotes as bigint)) as decimal)/ sum(cast(views as bigint)) as [upvotes/views]
    , cast(sum(cast(downvotes as bigint)) as decimal) / sum(cast(views as bigint))  as [downvotes/views]
    , cast((sum(cast(downvotes as bigint)) +sum(cast(upvotes as bigint)) ) as decimal)/ sum(cast(views as bigint))  as [total votes/views]
from (
select p.id as id
     , score as scores
     , viewcount as views
     , sum( case when v.votetypeid = 2 then 1 else 0 end) as upvotes  
     , sum( case when v.votetypeid = 3 then 1 else 0 end) as downvotes  
from posts  p
inner join votes v on v.postid = p.id
where p.posttypeid = 1 -- Q
and v.votetypeid in (2,3) -- upmod /downmod
group by p.id, score, viewcount
) allposts

Enter Parameters

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