Total score of a deleted user by tag

1

Please login or register to vote for this query.

(click on this box to dismiss)

Martial Arts Meta

Q&A about the site for students and teachers of all martial arts

SELECT
  t.TagName,
  SUM(p.Score) AS [Score],
  COUNT(p.Id) AS [Count],
  ROUND((CAST(SUM(p.Score) AS decimal))/(CAST(COUNT(p.Id) AS decimal)),2) AS [Average]
FROM Posts p INNER JOIN Posts q ON coalesce(p.ParentId, p.Id)=q.Id
  INNER JOIN PostTags pt ON q.Id = pt.PostId
  INNER JOIN Tags t ON pt.TagId = t.Id
WHERE (p.OwnerDisplayName='user' + Convert(nvarchar(20), ##UserId##)) AND
  (p.PostTypeId IN (##types?1,2##))
---1,2=both questions and answer
---1=questions
---2=answers  
GROUP BY t.TagName
ORDER BY SUM(p.Score) DESC

Enter Parameters

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