select concat('site://q/', cast(p.id as nvarchar),'|', m...

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 concat('site://q/', cast(p.id as nvarchar),'|',  min(title))   as [Post Link]
     , count(*) / cast(min(viewcount) as decimal) as [upvote / views ratio]
     , count(*) upvotes
     , min(viewcount) views
from posts p
inner join votes v on v.postid = p.id
where v.votetypeid = 2 
and posttypeid = 1 -- Q 
group by p.id
having min(viewcount) > 20
order by count(*) / cast(min(viewcount) as decimal) desc

Enter Parameters

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