generalist

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

With topTags As (
  Select Top 40 t.tagId
  From postTags t
  Group By t.tagId
  Order By Count(*) Desc
)
Select
  t.TagName,
  Sum( a.score ) As Score,
  Sum( Case When Sum( a.score ) >= 15 Then 1 Else 0 End ) Over ( ) As ReachedTags
From topTags tt
Join postTags pt On ( pt.tagId = tt.tagId )
Join tags t On ( t.id = tt.tagId )
Join posts q On (     q.id = pt.postId
                  And q.postTypeId = 1             -- only questions have tags
                  And q.communityOwnedDate Is Null -- community
)
Join posts a On ( a.parentId = q.id and a.communityOwnedDate is null)
Where a.ownerUserId = ##UserId##
Group By t.tagName
Order By score Desc

Enter Parameters

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