SELECT t.TagName, foo.SumViews, t.Count, foo.SumViews/t.C...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Anime and Manga

Q&A for anime and manga fans

SELECT
  t.TagName,
  foo.SumViews,
  t.Count,
  foo.SumViews/t.Count AS [Ratio]
FROM
  Tags AS t
  INNER JOIN (
    SELECT
      pt.TagId,
      SUM(p.ViewCount) AS [SumViews]
    FROM
      Posts AS p
      INNER JOIN PostTags AS pt
        ON p.Id = pt.PostId
    WHERE
      p.PostTypeId = 1
    GROUP BY
      pt.TagId
    ) AS foo
    ON t.Id = foo.TagId
WHERE
  t.Count >= 10
ORDER BY
  [Ratio] ASC

Enter Parameters

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