Q&A for Drupal developers and administrators
with singleTagPostIds as (select pt.postid as id from posts p join posttags pt on pt.postid = p.id where p.creationdate > '2020-11-30' group by pt.postid having count(pt.tagid) = 1), mostPopularTags as (select top 100 t.tagname, count(pt.postid) as cnt from singleTagPostIds stp join posttags pt on pt.postid = stp.id join tags t on t.id = pt.tagid group by t.id, t.tagname order by count(pt.postid) desc) select * from mostPopularTags order by tagname -- select top 10 count(tagid), postid from posttags group by postid having count(tagid) = 1