Q&A for designers and implementers of computer programming languages
SELECT TOP(##num?500##) t.TagName, t.Count, AVG(CAST(p.Score AS decimal)) [Average Score], AVG(CAST(p.ViewCount AS decimal)) [Average ViewCount], AVG(CAST(p.AnswerCount AS decimal)) [Average AnswerCout] FROM Posts p INNER JOIN PostTags pt ON p.Id = pt.PostId INNER JOIN Tags t ON pt.TagId = t.Id WHERE (t.Count>=##min?10##) AND (t.Count<=##max?1000000000000##) ---I have included both parameters min and max ---Sometimes we're interestedonly in large tags. ---Sometimes we might want to look only at small tags GROUP BY t.TagName, t.Count ORDER BY t.Count DESC