Tag trios by maximal average question score

1

Please login or register to vote for this query.

(click on this box to dismiss)

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

WITH Raw AS (
  SELECT TOP 100
    A.TagId AS TagA,
    B.TagId AS TagB,
    C.TagId AS TagC,
    AVG(1.0 *
      CASE
        WHEN Posts.Score > ##MaxPostScore:int?10##
        THEN ##MaxPostScore##
        ELSE Posts.Score
      END) AS Score,
    COUNT(*) AS Count
  FROM PostTags A, PostTags B, PostTags C, Posts
  WHERE
    Posts.Id = A.PostId
    AND
    Posts.Id = B.PostId
    AND
    Posts.Id = C.PostId
    AND
    A.TagId < B.TagId
    AND
    B.TagId < C.TagId
  GROUP BY
    A.TagId,
    B.TagId,
    C.TagId
  HAVING COUNT(*) > ##MinTagCount:int?100##
  ORDER BY Score DESC
)
SELECT
  A.TagName,
  B.TagName,
  C.TagName,
  Raw.Score,
  Raw.Count
FROM Raw, Tags A, Tags B, Tags C
WHERE
  Raw.TagA = A.Id
  AND
  Raw.TagB = B.Id
  AND
  Raw.TagC = C.Id
ORDER BY Score DESC, A.Id, B.Id, C.Id

Enter Parameters

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