SELECT TOP 100 Tags.TagName, COUNT(*) AS TagCount, SUM(Po...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Islam Meta

Q&A about the site for Muslims, experts in Islam, and those interested in learning more about Islam

SELECT TOP 100
    Tags.TagName, 
    COUNT(*) AS TagCount,
    SUM(Posts.ViewCount) AS TotalViewCount
FROM Tags
JOIN PostTags ON Tags.Id = PostTags.TagId
JOIN Posts ON PostTags.PostId = Posts.Id
WHERE Posts.PostTypeId = 1 -- Questions only
    AND Posts.CreationDate >= DATEADD(year, -1, GETDATE()) -- Within the last year
GROUP BY Tags.TagName
ORDER BY TagCount DESC;

Enter Parameters

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