Generalist

0

Please login or register to vote for this query.

(click on this box to dismiss)

Lifehacks

Q&A for people looking to bypass life's everyday problems with simple tricks

-- Generalist Progression

-- So I know what needs to be done
DECLARE @temp TABLE (
  id      INT IDENTITY(1, 1),
  TagName CHAR(128),
  score   INT);

WITH tags40
     AS (SELECT TOP 45 tagid
         FROM   posttags
         GROUP  BY tagid
         ORDER  BY Count(*) DESC),
     answers
     AS (SELECT score,
                id,
                parentId
         FROM   posts -- find responses of questions
         WHERE  communityowneddate IS NULL -- which are non-comm-wiki
                AND posttypeid = 2 -- answers
                AND owneruserid = ##UserId## -- by you
        )
INSERT @temp
       (TagName,
        score)
SELECT t.TagName,
       Sum(a.score) AS score
FROM   tags40 f
       INNER JOIN posttags pt
         ON f.tagid = pt.tagid
       INNER JOIN tags t
         ON f.tagid = t.id
       LEFT JOIN answers a
         ON pt.postid = a.parentId -- find tags of your answers
GROUP  BY t.tagname
ORDER  BY score DESC

SELECT *,
       CASE
         WHEN score >= 15 THEN ''
         ELSE '!'
       END
FROM   @temp

Enter Parameters

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