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

WITH tags40
     AS (SELECT TOP 45 tagid, Count(*)  as Cnt
         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
        )

SELECT t.TagName,
       Sum(a.score) AS score,
       Cnt,
       CASE
         WHEN Sum(a.score) >= 15 THEN ''
         ELSE '!'
       END       
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, Cnt
ORDER  BY Cnt DESC

Enter Parameters

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