downvote/upvote ratio of golang related tags


Please login or register to vote for this query.

(click on this box to dismiss)

Drupal Answers

Q&A for Drupal developers and administrators

golangposts as ( 
  select from posts p
  join posttags pt on pt.postid =
  where pt.tagid = 15627 and p.posttypeid = 1
  group by
q as (
  select count(*) as cnt, pt.tagid, v.votetypeid
  from golangposts as gop
  join posttags pt on pt.postid =
  join votes v on v.postid =
  where v.votetypeid in (2, 3)
  group by pt.tagid, v.votetypeid
select top 100 t.tagname AS [Tags], q.cnt AS [Upvotes], qq.cnt AS [Downvotes], ROUND(100.0 * qq.cnt / NULLIF(q.cnt, 0), 2) AS [D/U ratio]
from q
join tags t on = q.tagid
join q qq on q.tagid = qq.tagid and qq.votetypeid = 3
where q.votetypeid = 2
order by qq.cnt+q.cnt desc

Enter Parameters

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