SELECT Top 3 tgs.TagName as Tag ,COUNT(psttg.TagId) as No...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Earth Science

Q&A for those interested in the geology, meteorology, oceanography, and environmental sciences

SELECT Top 3
	tgs.TagName as Tag
	,COUNT(psttg.TagId) as NoOfTags
	,COUNT(DISTINCT usr.Id) as NoOfUsers
	,COUNT(DISTINCT pst.Id) as NoOfPosts
FROM Users usr
	Inner Join Posts pst ON pst.OwnerUserID = usr.Id
	Inner Join PostTags psttg ON psttg.PostId = pst.Id
	Inner Join Tags tgs ON tgs.Id = psttg.TagId
WHERE 1=1
	and UPPER(usr.DisplayName) like 'ANDR%'
	and pst.CreationDate >= CAST('2019-01-01' AS DATE)
	and pst.CreationDate <  CAST('2020-01-01' AS DATE)
GROUP BY tgs.TagName
HAVING 
	COUNT(DISTINCT usr.Id) < 500
	and COUNT(DISTINCT pst.Id) > 500
ORDER BY NoOfTags DESC
;

Enter Parameters

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