Q&A for passionate videogamers on all platforms
declare @tagname nvarchar (35) = 'html' select t.tagname as [Tag] , min(Posts.AnswerCount) as [Min] , avg(cast(Posts.AnswerCount as decimal)) as [Avg] , max(Posts.AnswerCount) as [Max] from Posts inner join posts a on a.parentid = Posts.id inner join posttags pt on pt.postid = Posts.id inner join tags t on t.id = pt.tagid where t.tagname = @tagname and Posts.PostTypeId=1 group by t.tagname