Based on Q#734, the accepted answer in meta
Q&A about the site for serious players and enthusiasts of chess
-- Journey to be a Generalist -- Based on Q#734, the accepted answer in meta with top40 as ( select top 40 t.id, t.tagname from tags t, posttags pt where pt.tagid = t.id group by t.tagname, t.id order by count(pt.postid) desc ), myanswers as( select p.parentid, p.score from posts p where p.owneruserid = ##UserID## and p.communityowneddate is null ) select t40.tagname as 'Tag', sum(p1.score) as 'Score', case when sum(p1.score) >= 15 then ':-)' else ':-(' end as 'Status' from top40 t40, myanswers p1, posttags pt1 where pt1.postid = p1.parentid and pt1.tagid = t40.id group by t40.tagname order by sum(p1.score) desc