Q&A for professional and enthusiast programmers
DECLARE @TagThresold int = ##TagThresold## SELECT t.TagName, SUM(p.ViewCount) AS Views, SUM(p.ViewCount) / COUNT(*) AS [Avg Views] FROM Posts p JOIN PostTags pt ON p.Id = pt.PostId JOIN Tags t ON pt.TagId = t.id WHERE t.Count > @TagThresold GROUP BY t.TagName ORDER BY [Avg Views] DESC