Compare two tags by view count and score.
Q&A for students, teachers, and linguists wanting to discuss the finer points of the Chinese language
DECLARE @TagName1 nvarchar = '##TagName1##' DECLARE @TagName2 nvarchar = '##TagName2##' SELECT Tags.TagName , AVG(Score) AS 'Average Score' , AVG(ViewCount) AS 'Average View Count' FROM Posts INNER JOIN PostTags ON Posts.Id=PostTags.PostId LEFT JOIN Tags ON PostTags.TagId = Tags.Id WHERE PostTypeId = 1 -- question AND Tags.TagName IN ( @TagName1 , @TagName2 ) GROUP BY Tags.TagName