Make wiki for these tags

1

Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

DECLARE @SiteAccountId INT = (
  SELECT Id FROM Users WHERE AccountId=##SEAccountId:int##
);

-- your tag scores
WITH Raw AS (
  SELECT
    PostTags.TagId,
    SUM(Posts.Score) AS YourScore,
    MIN(Tags.Count) AS TagCount
  FROM Posts, PostTags, Tags
  WHERE
    Posts.ParentId = PostTags.PostId
    AND
    Posts.OwnerUserId = @SiteAccountId
    AND
    PostTags.TagId = Tags.Id
  GROUP BY PostTags.TagId
),
Raw2 AS (
  SELECT
    A.TagId AS YourTagId,
    MIN(Raw.YourScore) AS YourScore,
    MIN(Raw.TagCount) AS TagCount,
    B.TagId AS SynTagId,
    COUNT(*) AS SynCount
  FROM Raw, PostTags A, PostTags B
  WHERE
    A.PostId = B.PostId
    AND
    A.TagId <> B.TagId
    AND
    Raw.TagId = A.TagId
  GROUP BY A.TagId, B.TagId
),
Raw3 AS (
  SELECT
    SynTagId,
    MIN(Tags.TagName) AS TagName,
    SUM(1.0 * SynCount / TagCount * YourScore) AS SynStrength
  FROM Raw2, Tags
  WHERE
    Raw2.SynTagId = Tags.Id
    AND
    Tags.WikiPostId IS NULL
    AND
    Tags.TagName NOT IN (SELECT SourceTagName FROM TagSynonyms)
  GROUP BY SynTagId
)
SELECT
  RANK() OVER (ORDER BY SynStrength DESC, TagName) AS Rank,
  TagName,
  SynStrength,
  'https://data.stackexchange.com/stackoverflow/query/1348631?TagName='
    + TagName + '#resultSet|Find it!' AS
    [Find it on other sites!]
FROM Raw3
WHERE SynStrength > 0
ORDER BY SynStrength DESC, TagName;

Enter Parameters

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