My score and number of non-CW answers per tag

0

Please login or register to vote for this query.

(click on this box to dismiss)

Craft CMS Meta

Q&A about the site for administrators, end users, developers and designers for Craft CMS

select *, power(1.0*score*score*IIF(posts<score, posts, score)*posts, 1.0/4) as truerank from
(select
tagname, sum(score) as score, count(*) as posts from
--* from
((SELECT
  t.TagName,
  a.Score as Score
FROM Posts a INNER JOIN Posts q ON q.Id=a.ParentId
  INNER JOIN PostTags pt ON q.Id = pt.PostId
  INNER JOIN Tags t ON pt.TagId = t.Id
WHERE (a.OwnerUserId=##userid##)
AND (a.CommunityOwnedDate IS NULL)) 
UNION all

SELECT
  t.TagName,
  0 as Score
FROM Posts q 
  INNER JOIN PostTags pt ON q.Id = pt.PostId
  INNER JOIN Tags t ON pt.TagId = t.Id
WHERE (q.OwnerUserId=##userid##)
AND (q.parentid is null)
AND (q.CommunityOwnedDate IS NULL)
) bb

GROUP BY Tagname   
)d
ORDER BY Score DESC, posts desc

Enter Parameters

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