SELECT TOP 10 Tags.TagName AS Subject, COUNT(*) AS Questi...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Music Fans Meta

Q&A about the site for music historians, critics, and fans

SELECT TOP 10
    Tags.TagName AS Subject, 
    COUNT(*) AS QuestionCount,
    SUM(Questions.ViewCount) AS TotalViewCount
FROM Tags
JOIN PostTags ON Tags.Id = PostTags.TagId
JOIN Posts AS Questions ON PostTags.PostId = Questions.Id
WHERE Questions.PostTypeId = 1 -- Questions only
    AND Questions.CreationDate >= DATEADD(year, -1, GETDATE()) -- Within the last year
GROUP BY Tags.TagName
ORDER BY QuestionCount DESC; -- Sorting by subjects with the most questions

Enter Parameters

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