SELECT t.TagName ["r"], STR(d.up,7,0) upvotes, STR(d.dn,7...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Emacs

Q&A for those using, extending or developing Emacs

SELECT
  t.TagName ["r"],
  STR(d.up,7,0) upvotes,
  STR(d.dn,7,0) downvotes,
  STR(100.0 * d.up / (d.up + d.dn),7,3) upvotesPct,
  STR(100.0 * (
    ((d.up + 1.9208) / (d.up + d.dn) 
    - 1.96 * SQRT((d.up * d.dn) / (d.up + d.dn) + 0.9604) 
    / (d.up + d.dn)) / (1 + 3.8416 / (d.up + d.dn))
  ),7,3) lowerBound,
  STR(t.Count,8,0) postcount
FROM
  (
    SELECT
      pt.TagId id,
      SUM(vc.up) up,
      SUM(vc.down) dn
    FROM PostTags pt
    INNER JOIN 
      (
        SELECT
          v.PostId pid,
          CAST(SUM(CASE v.VoteTypeId WHEN 2 THEN 1 ELSE 0 END) AS BIGINT) up,
          CAST(SUM(CASE v.VoteTypeId WHEN 3 THEN 1 ELSE 0 END) AS BIGINT) down
        FROM Votes v
        INNER JOIN Posts p ON p.Id = v.PostId
        WHERE p.PostTypeId = 1 AND p.ClosedDate IS NULL
        GROUP BY v.PostId
      ) vc ON vc.pid = pt.PostId
    GROUP BY pt.TagId
  ) d
INNER JOIN Tags t ON t.Id = d.id
WHERE (d.up + d.dn) > 0 AND t.Count >= ##MinimumPostCount?0##
ORDER BY lowerBound DESC

Enter Parameters

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